-1
如果一個人只支付信用卡公司要求的最低每月付款,該程序應計算一年後的信用卡餘額。當我嘗試運行它時,它顯示一個SyntaxError,我不知道爲什麼。這裏是我的代碼:每月信用卡付費計算器顯示語法錯誤
def ccb(balance, annualInterestRate, monthlyPaymentRate):
monthlyInterestRate = annualInterestRate/12.0
month = 0
for calc in range(12):
minMonthlyPaymentRate = balance * monthlyPaymentRate
unpaidBalance = balance - minMonthlyPaymentRate
interest = monthlyInterestRate * unpaidBalance
print ("Month | Balance | Unpaid Balance | Interest")
print (month + " | " + round(balance) + " | " + round(unpaidBalance) + " | " + Interest)
balance = unpaidBalance + Interest
month += 1
print ("Remaining balance: " + round(balance))
顯示完整的錯誤消息... – Li357
沒有語法錯誤代碼。這不是你的實際代碼,或者你得到的錯誤不是語法錯誤。 – marcelm