"""File: simple_int.py Purpose: Compute the amount of a principal given a simple interest rate and the time in years Run: python simple_int.py Input: Principal (decimal fraction) Interest rate (decimal fraction) Time in years (decimal fraction) Output: The amount """ #---------------------------------------------------------------------- def simple_int(P, r, t): """ Find the amount of a principal P invest for t years at interest rate r. """ A = P*(1+r*t) return A #---------------------------------------------------------------------- # Program starts executing here P = float(raw_input("Enter the principal\n")) r = float(raw_input("Enter the interest rate (decimal fraction)\n")) t = float(raw_input("Enter the time in years (decimal fraction)\n")) A = simple_int(P, r, t) print "If", P, "dollars is invested for", t, "years at interest rate", r print " then the amount will be", A, "dollars"