I am creating a script that allows me to calculate the future value of an investment at the end of x years, but I am having a little trouble writing the summation syntax in my script. I am not familar with the sum syntax so I do not know how it works. Any suggestions on how I should type it out? As you can see, I am new to Python.
def main(): print "This program calculates the future value" print "of a 10-year investment." principal = input("Enter the amount invested each year: ") interest_rate = input("Enter the annual interest rate: ") year = input("Enter the number of years: ") for i in range(1,year+1): value = sum(principal * (1 + interest_rate)**i) #error here =( print "The value in" , i , "years is" , value main()