'''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 )
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
Modify the function so that the user can specify the period of the investment. Further modify the function so that the user can make additional fixed yearly investments.
Specify 5 sets of test data you can use to test the program and the expected results for that test data. Provide test listings to verify your predictions.
Recently Asked Questions
- Mileage 1051 1145 1076 1344 1276 1286 1157 1398 1339 1291 1365 1528 1398 1366 1425 1286 1342 1451 1486 1385 1468 1536 1422 1449 McCoy Motors offers customers a
- How do I solve this one? I don’t know how to make deductions based only on given condition.
- Need answers as soon as possible. Thank you! Hopefully within the hour.