fork download
  1. P = int(input("Enter starting principle please. "))
  2.  
  3. n_str = input("Enter Compound interest rate.(daily, monthly, quarterly, half-year, yearly) ")
  4. n_lookup = {"daily":356, "monthly":12, "quarterly":4, "half-yearly":2, "yearly":1}
  5. n = n_lookup.get(n_str, 0)
  6.  
  7. r = float(input("Enter annual interest amount. (decimal) "))
  8. t = int(input("Enter the amount of years. "))
  9.  
  10. final = P * (((1 + (r/(100.0 * n))) ** (n*t)))
  11.  
  12. print ("The final amount after", t, "years is", final)
Success #stdin #stdout 0.02s 9328KB
stdin
1000
daily
0.10
5
stdout
Enter starting principle please. Enter Compound interest rate.(daily, monthly, quarterly, half-year, yearly) Enter annual interest amount. (decimal) Enter the amount of years. The final amount after 5 years is 1005.0125138017258