【发布时间】:2017-02-03 05:32:53
【问题描述】:
如果一个人只支付信用卡公司要求的最低每月付款,该程序应该在一年后计算信用卡余额。当我尝试运行它时,它显示一个 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))
【问题讨论】:
-
显示完整的错误信息...
-
该代码中没有语法错误。这不是你的实际代码,或者你得到的错误不是语法错误。
标签: python syntax-error banking