Advertisement
homeworkhelp111

Future_v2

Oct 18th, 2021 (edited)
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1. def future_value(P, i, t):
  2.   F = P * (1+i)**t
  3.   return F
  4.  
  5. def main():
  6.   P = float(input("Please enter the amount of money that you plan to invest:"))
  7.   while(True):
  8.     i = float(input("\nPlease enter the monthly interest rate (a value between 0 and 1):"))
  9.     if(i > 0 and i < 1):
  10.         break
  11.     else:
  12.         print("Value of i should be between 0 and 1, please try again!")
  13.        
  14.   t = int(input("\nPlease enter the total number of months that you plan to keep your money invested:"))
  15.   F = future_value(P,i,t)
  16.  
  17.   print("\nThe future value of your money is:"+str(F))
  18.  
  19. if __name__ == '__main__':
  20.     main()
  21.        
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement