TypeError: 'int' object is not callable (While working on google colaboratory)

TypeError: 'int' object is not callable (While working on google colaboratory)

在 python 中,我在执行期间遇到“类型错误:'int' 对象不可调用”。

我看过其他帖子,但我仍然不明白为什么会这样。

# Python code to find if a number is
# prime or not using divmod()

# Given integer
n = int(input("Enter a number"))
x = n

# Initialising counter to 0
count = 0
while x != 0:
    p, q = divmod(n, x)
    x -= 1
    if q == 0:
        count += 1
if count > 2:
    print(n, 'is Not Prime')
else:
    print(n, 'is Prime')

而且,请注意,它不会通过替换给出任何错误:

n = int(input("Enter a number"))n = int(input("Enter a number"))

我还提供了有关我的问题的屏幕截图

image

如果有人知道,请回答,感谢任何建议和意见。

你试过这样的东西吗?

z = input("Enter a number")
n = int(z)
x = n