【发布时间】:2022-11-28 10:40:00
【问题描述】:
num = int(input("enter num "))
if num <=0:
output= abs(num)
print(output)
else:
output =abs(num)
print(output)
TypeError Traceback (most recent call last)
<ipython-input-54-aba2c4ff0eb3> in <module>
3 INPUT: -1 OUTPUT: 1"""
4
----> 5 num = int(input("enter num "))
6
7
TypeError: 'int' object is not callable
【问题讨论】:
-
您的错误无法从您的代码中重现。如果您在 Jupyter notebook 中工作或在控制台中键入命令,请确保执行环境的干净重启。您可能为变量
int分配了一个数字,因此覆盖了int函数本身。
标签: python