IndentationError: unindent does not match any outer indentation level in python 3, idk the reason why
IndentationError: unindent does not match any outer indentation level in python 3, idk the reason why
number = 64
running = True
while running:
guess = int(input("write the number :"))
if guess == number:
print("Congrads! You won!")
running = False
elif guess < number:
print("No, the number is a bit bigger")
else:
print("No, the number is less")
else:
print("while cycle is over.")
else:
print("end")
我期待一个有效的代码,但有一些我看不到的错误,它在第四行说了这个问题,但同样,我看不出有什么问题
除 G. Anderson 外,您的代码中还有以下错误(查看注释):
number = 64
running = True
while running:
guess = int(input("write the number :")) # <-- is indented too much
if guess == number:
print("Congrads! You won!") # <-- also indented "two tabs"
running = False # <-- also indented "two tabs"
elif guess < number:
print("No, the number is a bit bigger")
else:
print("No, the number is less")
else:
print("while cycle is over.")
else: # <-- second else?
print("end")
这将是一个修复:
number = 64
running = True
while running:
guess = int(input("write the number :"))
if guess == number:
print("Congrads! You won!")
running = False
elif guess < number:
print("No, the number is a bit bigger")
else:
print("No, the number is less")
else:
print("while cycle is over.")
number = 64
running = True
while running:
guess = int(input("write the number :"))
if guess == number:
print("Congrads! You won!")
running = False
elif guess < number:
print("No, the number is a bit bigger")
else:
print("No, the number is less")
else:
print("while cycle is over.")
else:
print("end")
我期待一个有效的代码,但有一些我看不到的错误,它在第四行说了这个问题,但同样,我看不出有什么问题
除 G. Anderson 外,您的代码中还有以下错误(查看注释):
number = 64
running = True
while running:
guess = int(input("write the number :")) # <-- is indented too much
if guess == number:
print("Congrads! You won!") # <-- also indented "two tabs"
running = False # <-- also indented "two tabs"
elif guess < number:
print("No, the number is a bit bigger")
else:
print("No, the number is less")
else:
print("while cycle is over.")
else: # <-- second else?
print("end")
这将是一个修复:
number = 64
running = True
while running:
guess = int(input("write the number :"))
if guess == number:
print("Congrads! You won!")
running = False
elif guess < number:
print("No, the number is a bit bigger")
else:
print("No, the number is less")
else:
print("while cycle is over.")