代码只是给出了支付贷款的月数。
import sys
loanAmt = input("enter the amount of loan you want : ")
r = input("enter the rate of interest : ")
numOfPayments = input("enter number of payments : ")
month = loanAmt ( r * (1+numOfPayments) / ((1+r) * (numOfPayments-1)))
print(month)
ERROR:
TypeError: 'float object is not callable '
答案 0 :(得分:2)
loanAmt
是一个浮点数,你试图称之为:
month = loanAmt ( ... )
也许你想通过括号表达式的结果乘以该值?如果是这样,您错过了*
:
month = loanAmt * ( ... )
那么整行应该是:
month = loanAmt * (r * (1 + numOfPayments) / ((1 + r) * (numOfPayments - 1)))