2024-04-23 06:19:18 发布
网友
给出下列整数和计算
from __future__ import division a = 23 b = 45 c = 16 round((a/b)*0.9*c)
这将导致:
TypeError: 'int' object is not callable.
如何将输出舍入为整数?
我也犯了同样的错误
def xlim(i,k,s1,s2): x=i/(2*k) xl=x*(1-s2*x-s1*(1-x)) /(1-s2*x**2-2*s1*x(1-x)) return xl ... ... ... ... >>> xlim(1,100,0,0) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<stdin>", line 3, in xlim TypeError: 'int' object is not callable
读了这篇文章后,我意识到我忘了乘法
def xlim(i,k,s1,s2): x=i/(2*k) xl=x*(1-s2*x-s1*(1-x)) /(1-s2*x**2-2*s1*x*(1-x)) return xl xlim(1.0,100.0,0.0,0.0) 0.005
坦克
停止在其他地方踩踏round,方法是将int绑定到它。
round
int
在你的代码中的其他地方,你有这样的东西:
round = 42
当你写信的时候
round((a/b)*0.9*c)
这被解释为对绑定到round的对象(即int)的函数调用。但那失败了。
问题是无论什么代码都将int绑定到名称round。找到并移除它。
我也犯了同样的错误
读了这篇文章后,我意识到我忘了乘法
坦克
停止在其他地方踩踏
round
,方法是将int
绑定到它。在你的代码中的其他地方,你有这样的东西:
当你写信的时候
这被解释为对绑定到
round
的对象(即int
)的函数调用。但那失败了。问题是无论什么代码都将
int
绑定到名称round
。找到并移除它。相关问题 更多 >
编程相关推荐