TypeError: float cannot be called

I am trying to use values โ€‹โ€‹from an array in the following equation:

for x in range(len(prof)): PB = 2.25 * (1 - math.pow(math.e, (-3.7(prof[x])/2.25))) * (math.e, (0/2.25))) 

When I start, I get the following error:

 Traceback (most recent call last): File "C:/Users/cwpapine/Desktop/1mPro_Chlavg", line 240, in <module> PB = float(2.25 * (1 - math.pow(math.e, (-3.7(prof[x])/2.25))) * (math.e, (0/2.25))) TypeError: 'float' object is not callable 

it is probably something simple, but I cannot understand it. Any help would be greatly appreciated. thanks in advance

+10
source share
5 answers

Missing statement, probably * :

 -3.7 need_something_here (prof[x]) 

โ€œNot calledโ€ arises because the bracket โ€” and the lack of a statement that would switch the bracket to priority operators โ€” makes Python try to call the result -3.7 (float) as a function that is not allowed.

In this case, the brackets are also not needed, the following may be sufficient / correct:

 -3.7 * prof[x] 

As Legolas points out, there are other things that may need to be addressed:

 2.25 * (1 - math.pow(math.e, (-3.7(prof[x])/2.25))) * (math.e, (0/2.25))) ^-- op missing extra parenthesis --^ valid but questionable float*tuple --^ expression yields 0.0 always --^ 
+27
source

The problem is -3.7(prof[x]) , which looks like a function call (note the parens). Just use * , like that -3.7*prof[x] .

+3
source

Itโ€™s all because of '(-3.7 (prof [x])' - for example, you missed the statement.

+2
source

You forgot * between -3.7 and (prof[x]) .

Thus:

 for x in range(len(prof)): PB = 2.25 * (1 - math.pow(math.e, (-3.7 * (prof[x])/2.25))) * (math.e, (0/2.25))) 

It also seems to be missing ( because I count 6 times ( and 7 times ) , and I think (math.e, (0/2.25)) no function call (maybe math.pow ), but it's just wild hunch).

+2
source

I got this error when I tried to call a method when a property with the same name was available.

 float = 4.99 float("1") 
0
source

All Articles