因此,我試圖編寫一個函數,要求3件事要投入的金額,利率和投資的持續時間,然後將其輸出到年份,利息和總計列。格式化輸出到列
def figinvest():
amount = eval(input("Please give me the amount invested: "))
interest = eval(input("Please give me the current interest rate as a decimal: "))
duration = eval(input("Please give me the duration of the investment: "))
info = []
輸出應該是這樣的:
Year Interest Total
0 0.00 3000.00
1 165.00 3165.00
2 174.07 3339.07
etc.
列表項
print("Year Interest Total")
這是我到目前爲止所。我只是停留在如何使用輸入並將其放入列中。
它使用python – mb13 2014-11-24 06:01:21