Advertisement
Guest User

Untitled

a guest
Sep 25th, 2014
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.85 KB | None | 0 0
  1. def calc():
  2.     choice = raw_input("What type of interest is it you want to calculate?\n1. Simple Interest - 1\n2. Compound Interest - 2\nPlease Choose 1 or 2: ")
  3.  
  4.     if choice == "1":
  5.         p = raw_input("Enter the Amount Borrowed: ")
  6.         r = raw_input("Enter the Interest Rate: ")
  7.         t = raw_input("Enter the Amount of Time: ")
  8.         i = int(p) * float(r) * int(t)
  9.         ans = float(i) + float(p)
  10.         print "You Will Owe %r Dollars Back to Your Lender" % ans
  11.    
  12.  
  13.     if choice == "2":
  14.         p = raw_input("Enter the Principal Amount: ")
  15.         i = raw_input("Enter the Interest Percentage: ")
  16.         t = raw_input("How Many Intervals Until Loan Ends?: ")
  17.         ans = float(p) * (1 + float(i)) ** float(t)
  18.         print "You'll Owe Back %r in Interest." % ans
  19.         calc()
  20.        
  21.     else:
  22.         calc()
  23.  
  24. calc()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement