-2
计算列表的总和。当我尝试添加了列表它产生以下错误元素浮动对象不可调用的错误,而在Python
print weights
print sum(weights)
我收到以下错误
[0.2, 0.2, 0.2, 0.2, 0.2]
TypeError Traceback (most recent call last)
<ipython-input-77-f2d5440b3427> in <module>()
1 print weights
----> 2 print sum(weights)
3
TypeError: 'float' object is not callable
你有一个叫做“sum”的变量吗?如果你这样做,它将在该功能之前使用。 – DavidW