-4

我有这个代码:

balance = 4213
annualInterestRate = 0.2
monthlyPaymentRate = 0.04
monthly_interest_rate = annualInterestRate / 12.0
for counter in range(1, 12):
    payment = monthlyPaymentRate * balance
    monthly_unpaid_balance = balance - payment
    balance = monthly_unpaid_balance + (monthly_interest_rate * monthly_unpaid_balance)
    print('Month: {}\nMinimum monthly payment: {}\nRemaining balance:{}'.format(
              counter, round(payment, 2), round(balance, 2)))

我如何计算总支付(所有最低每月支付的总和)?

4

2 回答 2

2

我认为您只计算 11 个月而不是 12 个月。

for counter in range(1, 12+1)
于 2013-11-02T16:48:15.197 回答
1

您从我的回答中错误地复制粘贴。范围应该是直到13

于 2013-11-02T16:51:22.393 回答