Each month, Pytho puts $100 into her bank account. Initially, she has $0 in the
ID: 3743901 • Letter: E
Question
Each month, Pytho puts $100 into her bank account. Initially, she has $0 in the account. At the end of each month, she earns 2% interest on her current balance, before the next deposit. She would like a function that can predict her balance after n months. Complete the function below so that the function returns the final balance. Keep in mind that t0 corresponds to now. In [2]: def final balance (n): #A-amount, p-principle, r-interest rate, n-number of times interest is compounded t-time (years) P 100 82 t 1 Return final_balace(P (1+r/n)**nt) Return final_balance File "", line 9 Return final_balance(P (1+r/n)* nt) SyntaxError: invalid syntaxExplanation / Answer
def final_balance(n): P = 100 r = 0.02 return P*(1+r)**n print('Final balance after 10 months is', final_balance(10))
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.