Question: Recall the Account class from the Module 3 video lectures. class Account: interest = 0.02 def _init__(self, account_holder): self.holder = account_holder self.balance = 0 def
Recall the Account class from the Module 3 video lectures. class Account: interest = 0.02 def _init__(self, account_holder): self.holder = account_holder self.balance = 0 def deposit (self, amount): self.balance = self.balance + amount return self. balance def withdraw(self, amount): if amount > self balance: return "Not enough funds self.balance = self. balance - amount return self balance Write the Python code to implement toRetiretamount), a method of the Account class that takes numeric value as a parameter (amount). This method returns how many years the holder would need to wait in order for the current balance to grow to at least amount, assuming that the bank adds balance times the interest rate at the end of every year. For example, if the holder has a balance of 10 dollars, at a 2% interest, to Retire(10.25) would return 2, since balance goes from 10 tn 10.2 to 10.404
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
