Case Study: Building Software in Python
Mark Pedigo, PhD
Principal Data Scientist
Determining mortgage for new homes
+
, -
, *
, /
, **
Code is reused between classes
FinancialCalculator
) inherits all functionality from the parent class (BasicCalculator
)class BasicCalculator:
def multiply(self, x, y):
result = x * y
return result
...
# Child of BasicCalculator
class FinancialCalculator(BasicCalculator):
def months_from_years(self, years):
# Inherits the .multiply() method
return self.multiply(years, 12)
...
doctest
and unit testingCase Study: Building Software in Python