การใช้ Docstring
สร้างคลาส MortgageCalculator เสร็จแล้ว ต่อไปให้เติม docstring เพื่ออธิบาย attribute ต่าง ๆ ของคลาสให้ครบถ้วน
แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร
กรณีศึกษา: การสร้างซอฟต์แวร์ด้วย Python
คำแนะนำการฝึกหัด
- สำหรับ attribute
monthsให้เพิ่มข้อความว่าthe number of months in the loan - สำหรับ attribute
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