Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/288.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 类型错误:';浮动';对象不可调用_Python_Math_Types - Fatal编程技术网

Python 类型错误:';浮动';对象不可调用

Python 类型错误:';浮动';对象不可调用,python,math,types,Python,Math,Types,我试图在以下等式中使用数组中的值: 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))) 运行时,我收到以下错误: Traceback (most recent call last): File "C:/Users/cwpapine/Desktop/1mPro_Chlavg", line 240, in <module&

我试图在以下等式中使用数组中的值:

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)))
运行时,我收到以下错误:

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
回溯(最近一次呼叫最后一次):
文件“C:/Users/cwpapine/Desktop/1mPro_Chlavg”,第240行,在
PB=float(2.25*(1-math.pow(math.e,--3.7(prof[x])/2.25))*(math.e,(0/2.25)))
TypeError:“float”对象不可调用
这可能很简单,但我不太明白。任何帮助都可能是错误的
非常感谢。提前感谢

缺少操作员,可能是
*

-3.7 need_something_here (prof[x])
之所以出现“不可调用”,是因为括号——以及缺少将括号转换为优先运算符的运算符——使得Python尝试将
-3.7
(浮点)的结果作为函数调用,这是不允许的

在这种情况下也不需要括号,以下内容可能足够/正确:

-3.7 * prof[x]

正如莱格拉斯所指出的,还有其他一些问题需要解决:

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 --^

您忘记了
-3.7
(prof[x])
之间的
*

因此:


另外,似乎缺少了一个
,因为我数了6次
和7次
,我认为
(math.e,(0/2.25))
缺少一个函数调用(可能
math.pow
,但这只是一个猜测)。

问题在于
-3.7(prof[x])
,它看起来像一个函数调用(注意参数)。只需像这样使用一个
*
-3.7*prof[x]

您缺少一个操作:
-3.7(prof[x])
它应该是
-3.7*(prof[x])
或者……我在一个类中遇到了同样的异常,我有一个float属性和一个同名的方法。将其中一个重命名为meNote解决了这个问题,还有更多的右括号而不是右括号,第二个逗号似乎是关闭的。谢谢legolas和其他人,我注意到我的等式中有几个拼写错误。也许我需要这样做休息一下,让我的眼睛休息一下:-)请不要抄袭别人的答案请不要抄袭别人的答案。
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)))