In: Computer Science
Write a PYTHON program that prompts the user to enter the account’s present value, yearly interest rate, and the number of years that the money will be left in the account. The program should pass these values to a function that returns the future value of the account, after the specified number of months. The program should display the accounts’ future value
Python code:
#defining function to print future value
def future_value(value,rate,years):
#returning future value
return value*(1+rate/100)**years
#accepting present value
value=int(input("Enter the present value: "))
#accepting intrest rate
rate=int(input("Enter the intrest rate: "))
#accepting number of years
years=int(input("Enter the number of years: "))
#calling future_value function and printing future value
print("Future value is
{:.2f}".format(future_value(value,rate,years)))
Screenshot:
Input and Output: