# # Sep 16 homework # chap 2 exercise 7, pg 49 # Jim Mahoney's example solution. # # This is a modified version of the textbook's futval.py # print "--- chap2ex7.py : compound interest " annual_interest_rate = input( "What is the annual percent interest rate? (i.e. 3.0) ") annual_periods = input("How many periods are there per year? (i.e. 12) ") interest_per_period = float(annual_interest_rate) / annual_periods principal = input("What is the initial principal? (i.e. 100.00) ") years = 10 for month in range(annual_periods * years): principal = (1.0 + interest_per_period/100.00) * principal print " principal = ", principal, "after", (month+1), "months" print "Done. After", years, "years, the principal is", principal