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