您好我所有尝试使用python制作贷款计算器,但我无法弄清楚为什么我会收到3个语法错误,所有这些都与变量firstOperation有关。
interestRate = raw_input("Annual interest rate: ")
paymentsPerYear = raw_input("Number of payments per year: ")
length = raw_input("Length of the loan in years: ")
interest = float(interestRate)/float(paymentsPerYear)
presentValue = raw_input("Present Value: ")
firstOperation = interest*float(presentValue)
secondOperation = 1-(1+interest)**-(float(length)*float(paymentsPerYear)
print(firstOperation)
print(secondOperation)
payment = firstOperation/secondOperation
print(payment)
答案 0 :(得分:1)
你在跟进行中有错误。最后缺少)
。
secondOperation = 1-(1+interest)**-(float(length)*float(paymentsPerYear)