这是我的代码
a = int(input())
b = int(input())
s = a + b
print(s)
这是错误
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-30-c32c26f2800f> in <module>
2 b = int(input())
3 s = a + b
----> 4 print(s)
TypeError: 'int' object is not callable
此工作代码在python 3中有效-链接-https://snakify.org/en/lessons/print_input_numbers/
但是在Jupyter Notebook中不起作用。这是Jupyter问题还是python问题?
我相信您有一个int
名为的值的变量print
,从而导致错误。
观察:
a = int(input())
b = int(input())
s = a + b
print(s)
输出:
5
6
11
VS
print = 7
a = int(input())
b = int(input())
s = a + b
print(s)
输出:
5
6
Traceback (most recent call last):
File "C:/Users/wil/Desktop/t.py", line 5, in <module>
print(s)
TypeError: 'int' object is not callable
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句