Python 3.x “int”对象是不可调用的错误,而True为循环 数学测验 异常处理
我已经写了一个程序来生成一个快速的。我添加了一个while-True循环,以便在需要时再次运行程序。但是,当我运行该程序时,会出现以下错误:Python 3.x “int”对象是不可调用的错误,而True为循环 数学测验 异常处理,python-3.x,Python 3.x,我已经写了一个程序来生成一个快速的。我添加了一个while-True循环,以便在需要时再次运行程序。但是,当我运行该程序时,会出现以下错误: What is 93 - 3? 90 Traceback (most recent call last): File "/Users/Family/Google Drive/V4.4.py", line 114, in <module> score() TypeError: 'int' object is not callable
What is 93 - 3?
90
Traceback (most recent call last):
File "/Users/Family/Google Drive/V4.4.py", line 114, in <module>
score()
TypeError: 'int' object is not callable
是什么导致了我的错误。请发布完整的代码。现在,问题中缺少有问题的代码。我在剩下的代码中添加了函数和变量都称为score。至少重命名一个,问题可能会消失。哦,看来您最初发布的代码已经足够了。只有缩进不正确。不,等等。回溯没有分数帧的痕迹。因此,无法在def分数内引发异常:。你能把代码缩进并告诉我们114行在哪里吗?
while True:
try:
global UserAnswer # Makes the UserAnswer varialbe availbe to the whole program for later use
UserAnswer= float(input()) # Convertss the input into a floating number that can be operated
break
except ValueError:
print(" Oops! That was not a valid number. Try again..." )
return answer
def askQuestion():
answer =questions()
guess = UserAnswer
return guess == answer
def score():
score = 0
for i in range(10):
correct= questions()
if UserAnswer == answer :
score =score + l1
print("You got it right \n ")
else:
print("You got it wrong \n")
print("You got {} out of 10 \n".format(score))
ok= True
while ok== True:
questions()
score()
WhichClass(name,score)
ask=(input("Another ? "))
if ask in ('y','yes','Y'):
ok=True
else:
ok=False
What is 93 - 3?
90
Traceback (most recent call last):
File "/Users/Family/Google Drive/V4.4.py", line 114, in <module>
score()
TypeError: 'int' object is not callable