# L-11 MCS 260 Fri 5 Feb 2010 a for loop # # Shows annual growth of an investment. # The user enters principal, interest rate, # and the number of years. After each year # the balance of the investment are shown. # print 'Calculation of the annual balance' B = input('Give amount to invest : ') r = input('Give annual interest rate : ') n = input('Give number of years : ') print 'At year %d : Balance = $%.2f' % (0,B) for i in range(1,n+1): B *= (1 + r/100) print 'At year %d : Balance = $%.2f' % (i,B)