我是 Python 的初学者,正在做作业。TypeError: unsupported operand type(s) for -: 'int' and 'function'
即使在研究了错误并应用了建议的修复程序之后,我也会继续努力。我不是在寻找任何人给我一个解决方案,但我会很感激再看一眼。我错过了一些东西,但我不知道是什么。这是我遇到问题的代码部分:
month = 0
interestYDT = 0
balance = int(raw_input ("Enter balance on credit card: "))
annualInterestRate = float(raw_input ("Enter annual interest rate as a decimal: "))
monthlyPaymentRate = float(raw_input ("Enter minimum monthly payment rate as a decimal: "))
previousbalance = balance
#
def monthlyInterestRate(annualInterestRate):
return float(annualInterestRate/12)
#
if month <= 12:
def minimumMonthlyPayment(previousbalance):
return (previousbalance * monthlyPaymentRate)
def monthlyInterest(monthlyInterestRate):
return (1 + monthlyInterestRate)
minMonPay = minimumMonthlyPayment
monInt = monthlyInterest
newbalance = ((previousbalance - minMonPay) * (monInt))
interestYDT = (interestYTD + montInt)
previousbalance = (newbalance)
print ''
print ('Month:' (month))
print ('Minimum monthly payment: $ ' (round(minimumMonthlyPayment, 2)))
print ('Remainging balance: $ ' (round(newbalance, 2)))
print ' '
month = (month + 1)
这是我得到的全部错误:
Traceback (most recent call last):
File "C:/Users/Karla/Documents/_MIT 600X Introduction to CS and Prog/Assignments/Week2/kmarciszewski_week2_Problemset_Problem1.py", line 33, in <module>
newbalance = ((previousbalance - minMonPay) * (monInt))
TypeError: unsupported operand type(s) for -: 'int' and 'function'
我真的很感激任何见解。谢谢你。