Typeerror Float Is Not Callable. Im Trying To Figure Out Why My Elif Statement Are Not Callable
from cisc106_32 import* def BillAmount(mb): if mb <= 50: price=50 elif 50
Solution 1:
In most programming languages, when multiplying numbers, you need a *. e.g.:
result = (0.5) * (mb - 50.00)
(unlike in math when you write result=(0.5)(y)(500) and the multiplication is implied.)
Solution 2:
You are trying to make a float number into a function:
(.05)(mb-50.00)
If you meant to multiply the two values, use *:
(.05) * (mb-50.00)
Illustration:
>>> mb=51>>> (.05)(mb-50.00)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'float'objectisnotcallable>>> (.05)*(mb-50.00)
0.050000000000000003Solution 3:
In Python, () is regarded as function operator.. So, if you add parenthesis to any word in Python, it becomes a function call (Well, there are some exceptions though, but that is not the concern here) ..
So, if you do this: -(2)(5) , you are not multiplying 2 and 5, rather you are trying to invoke a function 2 which does not exists with argument 5..
So, add a * in between these parenthesis to make it (2)*(5)
Post a Comment for "Typeerror Float Is Not Callable. Im Trying To Figure Out Why My Elif Statement Are Not Callable"