def main():
print "This program calculates the future value of a 10-year investment"
principal = input("enter the initial principle: ")
years = input("enter number of years you want to invest: ")
apr = input("Enter the APR: ")
for i in range(years):
principal = principal * (1 + apr)
print "The amount in" years "years is: " , years, principal
main()
我在这里收到错误。我如何获得最终的打印语句以显示输入值。如何使输入显示在Python的打印语句中
这个工作和我是这么认为的书要我做。上面的代表什么意思? – user1547428 2012-07-24 03:37:48
'str(年)'给你几年的字符串表示。 – BrenBarn 2012-07-24 03:41:16