[Tutor] python strings?

andrade1@umbc.edu andrade1 at umbc.edu
Thu Sep 8 16:06:46 CEST 2005

below is my program. what i would like to do is to get the last line to
print the number of years that the user enters and also the principal

# A program to compute the value of an investment
# years into the future

def main():
    print "This program calculates the future value of an investment over

    principal = input("Enter the initial principal: ")
    apr = input("Enter the annual interest rate: ")
    years = input("Enter the number of years: ")

    for i in range(10):
        principal = principal * (1 + apr)

    print "The value in years is", principal


More information about the Tutor mailing list