It is Pytthon question: Write a function that computes future investment value a
ID: 3829257 • Letter: I
Question
It is Pytthon question:
Write a function that computes future investment value at a given interest rate for a specified number of years. The future investment is determined using the following formula: futureInvestment Value = investmentAmount times (1 + monthlyInterestRate) numberOfYears *12 Use the following function header: def value futureInvestmentValue(investmentAmount, monthlylnterestRate, years) For example, futureInvestmentvalue(10000, 0.05/12, 5) returns 12833.59. Write a test program that prompts the user to enter the investment amount (e.g., 1000) and the interest rate (e.g., 9%) and prints a table that displays future value for the years from 1 to 30, as shown below:Explanation / Answer
def futureInvestmentValue(investmentAmount, monthlyInterestRate, years):
futValue = investmentAmount*((1+monthlyInterestRate)**(years*12))
return futValue
investmentAmount = float(input("The amount invested: "))
rate = float(input("Annual interest rate: "))
monthlyInterestRate = rate/12
print("Years_________________Future Value")
for i in range(1, 31):
print(str(i) + "______________________" + "{0:.2f}".format(futureInvestmentValue(investmentAmount,monthlyInterestRate, i)))
# code link: https://paste.ee/p/hBHTn
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.