ケーススタディ:Pythonでソフトウェアを構築する
Mark Pedigo, PhD
Principal Data Scientist

新築住宅の住宅ローンを算定

+, -, *, /, **
クラス間でコードを再利用する
FinancialCalculator)は親クラス(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 と単体テスト

ケーススタディ:Pythonでソフトウェアを構築する