我有作业要做,我做了。我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+(annualinterestate/12)),2)。这可能是一个非常简单的问题,但我是Python的新手,无法理解到底是什么问题,我知道Python对空格和缩进非常敏感,对此我很小心。有什么建议吗?你知道吗
有三个开放的paren,但有两个封闭的paren。你知道吗
相关问题 更多 >
编程相关推荐