शुरू करेंमुफ़्त में शुरू करें

Mortgage कैलकुलेटर क्लास बनाएँ

आपने BasicCalculator से शुरुआत की थी जो बेसिक arithmetic करता था.

फिर आपने FinancialCalculator बनाया जो BasicCalculator से इनहेरिट करता है. आपने इस क्लास में एक मेथड monthly_interest() जोड़कर विस्तार किया, जो वार्षिक ब्याज दर दिए जाने पर मासिक ब्याज निकालता है.

अब MortgageCalculator क्लास बनाने का समय है!

यह अभ्यास पाठ्यक्रम का हिस्सा है

केस स्टडी: Python में सॉफ्टवेयर बनाना

पाठ्यक्रम देखें

अभ्यास निर्देश

  • पैरेंट का नाम लिए बिना, उसके methods और attributes को instantiate करें.
  • उपयुक्त पैरामीटर का उपयोग करके self.loan_amount को initialize करें.
  • इनहेरिटेड मेथड का उपयोग करके self.monthly_interest_rate को initialize करें.

इंटरैक्टिव व्यावहारिक अभ्यास

इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।

class MortgageCalculator(FinancialCalculator):
  def __init__(self, loan_amount, annual_interest_rate, years):
    # Initialize the parent attributes and functions
    ____
    
	# Initialize the loan_amount attribute
    self.loan_amount = ____
    
    # Initialize the monthly_interest_rate
    self.monthly_interest_rate = self.____(annual_interest_rate)
कोड संपादित करें और चलाएँ