我使用 google colab 运行此代码,它会出现问题,但是当我在 jupyter notebook 中运行它时,它似乎没问题。我不知道为什么。有人可以帮助我。非常感谢。
tokens = input("Enter a number: ")
tokens = tokens.split()
a = int(tokens[0])
b = int(tokens[1])
print(a + b)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-51-67bc049ba749> in <module>()
----> 1 tokens = input("Enter a number: ")
2 tokens = tokens.split()
3 a = int(tokens[0])
4 b = int(tokens[1])
5 print(a + b)
TypeError: 'str' object is not callable