0
對於一些背景,我已經編程了很多年,但直到現在從未真正感動過Python,我不確定這裏出了什麼問題,IDLE正在標記第24行(最後一行) :Python - 打印函數的語法錯誤2.7
'''
Test Cases
'''
balance = 4213
annualInterestRate = 0.2
monthlyPaymentRate = 0.04
'''
Variables
'''
previousBalance = 0
monthlyInterestRate = 0
minMonthlyPayment = 0
totalPaid = 0
m = 1
while (m != 12):
monthlyInterestRate = annualInterestRate/12
minMonthlyPayment = monthlyPaymentRate * previousBalance
balance = (previousBalance - minMonthlyPayment) * (1 + monthlyInterestRate)
totalPaid = totalPaid + minMonthlyPayment
previousBalance = balance
m += 1
print('Month: ' + str(m))
print('Minimum monthly payment: ' + str(minMonthlyPayment))
print('Total paid: ' + str(round(totalPaid, 2))
print('Remaining balance: ' + str(round(balance, 2)) #Flagging Here
如果任何人有任何想法,爲什麼最後的打印功能會導致任何問題,請讓我知道。
嗯,我不是我見過的最聰明的小東西。感謝-_-我覺得自己像一個白癡 –
@JuniperAsh:這很難習慣 - 解釋者一直吃掉線,直到遇到無法解析的東西。如果你有語法錯誤,你應該看的第一個地方是上一行。 –