Question: This code should prompt the user for a starting balance, annual interest rate, and number of years, and print out the ending balance, assuming that
This code should prompt the user for a starting balance, annual interest rate, and number of years, and print out the ending balance, assuming that interest is compounded annually. You should use a while loop (as opposed to a closed-form expression) to calculate the final balance.
$ python3 interest.py Enter starting balance: 1000 Enter interest rate: 0.1 Enter number of years interest is accrued: 1 Final balance = 1100.0 $ python3 interest.py Enter starting balance: 1000 Enter interest rate: 0.05 Enter number of years interest is accrued: 10 Final balance = 1628.894626777441 $ python3 interest.py Enter starting balance: 100 Enter interest rate: 0.34 Enter number of years interest is accrued: 0 Final balance = 100.0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
