Here is a program that calculates the final value of a 10 year fixed term investment, given the initial investment amount and the interest rate.
'''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
- Berenstein Corporation used the equity method to report the following transactions for the years 2017 and 2018: 2017 Feb. 2 Purchased 30 % of the voting common
- Need help with a basic SQL query...it should return the average rating for all movies and each of these movies is both "Comedy" and "Romance" and the query
- Given P ( A ) =0.8and P ( B ) =0.4, do the following. (For each answer, enter a number.) (a)If A and B are independent events, compute P ( A and B ). (b) If P