'''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?

Recommended Answers

All 4 Replies

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

Tony

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 ??

actually i think ive worked it out

Thanks tony
:)

Can you mark solved or tell what is still unclear/post results?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.