开始使用免费开始使用

使用文档字符串

您已经开发了 MortgageCalculator 类。现在,请完善文档字符串,为该类的属性提供说明。

本练习是课程的一部分

案例研究:用 Python 构建软件

查看课程

练习说明

  • 对于 months 属性,添加 the number of months in the loan
  • 对于 monthly_payment 属性,添加 the amount of the payment per month

交互式实操练习

通过完成这段示例代码来试试这个练习。

class MortgageCalculator(FinancialCalculator):

  """
  A class used to represent a mortgage calculator.

  Attributes
  -------
  months: ____.
  monthly_payment: ____.
  """
  # Code omitted for space
编辑并运行代码