0
'''calculate the future value of an investment after 10 years''' 

def calcValue( initialValue, interestRate ): 
    period = 10 
    investmentValue = initialValue 

    for i in range(period): 
        investmentValue = investmentValue * ( 1 + interestRate ) 

    return investmentValue 

def main(): 
    principal = int(raw_input("Enter initial investment amount: ")) 
    interest = float(raw_input("Enter interest rate as a percentage: ")) / 100 

    finalValue = calcValue( principal, interest ) 
    print "Final value of the investment is $%0.2f" % finalValue 

main()

i need to modify this program so that a user can specify the period of invest and so the user can make additional yearly investments.

i'm just unsure how to approach the question

Any sugesstions?

2
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by pyTony
0

See how period is used and how it's use can become similar to other values in the formula.

Tony

0

See how period is used and how it's use can become similar to other values in the formula.

Tony

So to take the period = 10 out and turn it into raw_input ??

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.