Donna Belle Ibarra wrote:
Hi! I need help with program exericse #6 entitled "Futval.py" which is a program that computes the value of an investment carried 10 years into the future.

This is the coding I have.. yet it does not seem to spit out the correct numbers (Am I using an incorrect equation?)

Take a look at http://en.wikipedia.org/wiki/Time_value_of_money#Present_value_of_a_future_sum for the various formulas. I am not sure which applies in your case.


def main():
    print "This program calculates the future value"
    print "of a 10-year investment."

    principal = input("Enter the amount invested each year: ")
    apr = input("Enter the annual interest rate: ")
    years = input("Enter the number of years: ")

    for i in range (1, years + 1):
        principal = principal * (1 + apr)**i
        print "The value in", i, " years is:", principal

main()


The output is suppose to appear like this:

This program calculates the future value of a 10-year investment.
Enter the amount invested each year: 100.00
Enter the annual interst rate: 0.05
Enter the number of years: 10
The value in 1 years is 105.0
The value in 2 years is 215.25
The value in 3 years is 331.0125
The value in 4 years is 452.563125

And so on..

^Please help me!!!

_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor


--
Bob Gailer
Chapel Hill NC
919-636-4239


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to