我有作业要做,我做到了。我 95% 确定它是一个正确的代码。我不知道为什么但不幸的是我在其中一行中遇到了语法错误。这是我的代码:
month = 1
totalPaid = 0
while month <= 12:
print('Month: ' + str(month))
print('Minimum monthly payment: ' + str(round(monthlyPaymentRate * balance), 2)
balance = round((balance - (monthlyPaymentRate * balance)) * (1 + (annualInterestRate/12)),2)
print('Remaining balance: ' + str(round(balance, 2)))
month = month + 1
totalPaid = totalPaid + round((monthlyPaymentRate * balance), 2)
print('Total paid: ' + str(totalPaid))
print('Remaining balance: ' + str(balance))
我在这一行遇到语法错误: balance = round((balance - (monthlyPaymentRate * balance)) * (1 + (annualInterestRate/12)),2)。这可能是非常简单的事情,但我是 Python 的新手,无法理解到底是什么问题,我知道 Python 对空格和缩进非常敏感,我对此很小心。有什么建议么 ?