Suppose you have an investment plan where you invest a certain fixed amount ever
ID: 3883884 • Letter: S
Question
Suppose you have an investment plan where you invest a certain fixed amount every year. Modify futval.py to compute the total accumulation of your investment. The inputs to the program will be the amount to invest each year, the interest rate, and the number of years for the investment.”
use python instruction for each year, you are to add the annual amount to be invested each year to the current total and then apply interest to that full amount. Make certain your inputs are in the order specified in the problem. Write down a few equations that shows what would happen the first three years with $1,000 invested each year at 10% and then match up the numbers with variable names to help you get the correct formula. Note, you must use a loop for this assignment. The exponentiation technique does not work when you are add an investment amount each year.
Explanation / Answer
def main():
print("This program calculates the future value of an investment plus yearly contributions.")
principal = eval(input("Enter the initial principal: "))
eachyr = eval(input("investment for every year?: "))
apr = eval(input("Annual interest rate: "))
yr = eval(input("Number of years: "))
for i in range (yr):
principal = principal * (1 + apr) + eachyr
print("The value in", yr , "years is $""{0:.2f}" .format(principal))
main()
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.