每当我运行此代码时,它会出现无效的语法,但我不知道哪些部分是错误的(空闲不显示错误)。如果你能提供帮助就可以成为一个先例
go = True
def loop():
response1 = input ("Enter number: ")
print ("Thank you for " + response1)
number1 = int(response1)
response2 = input ("Enter second number: ")
print ("Thank you for " + response2)
number2 = int(response2)
if int(number1) == int(number2):
print (str(number1) + " is equal to " + str(number2))
elif int(number1) != int(number2):
print (str(number1) + " is not equal to " + str(number2))
while go:
loop()
答案 0 :(得分:2)
elif indention不正确。见下文
if int(number1) == int(number2):
print (str(number1) + " is equal to " + str(number2))
elif int(number1) != int(number2):
print (str(number1) + " is not equal to " + str(number2))
答案 1 :(得分:1)
您需要修复InvocationTargetException
的缩进:
elif