# futureValue.py # Given the principal amount, the interest rate and the number of compounding periods, # the program calculates the value of the investment ten years into the future. def main(): print("Given the principal amount, the annual percentage yield, and the number of years,\n \ the program calculates the value of the investment after each year.") p = eval(input("Enter the amount to invest (initial principal): ")) apy = eval(input("Enter the interest rate (APY) in percent %: ")) n = eval(input("Enter the number of years: ")) result = p # using extra variable to keep the original value of p unchanged for i in range(n): # 10 iterations for 10 years result = result + result*apy/100 # every year the balance in changing print("Balance after",i+1,"year(s):\t $",round(result,2)) main()