【发布时间】:2022-01-01 04:00:23
【问题描述】:
我现在遇到的麻烦是这个。由于原代码太长,这里就不写了,我跳过了每一个公告和reply1,2,3的elif,else术语。当我在 line6:reply2 = input() 中输入错误的输入时,我希望看到程序回到 line5:print(choice_2)。但是程序继续返回我 print(choice_1) 我该如何解决这个问题?任何帮助将不胜感激。
while True:
print(choice_1)
reply1 = input()
if reply1 in pos:
print(choice_2)
reply2 = input()
if reply2 in pos():
print(choice_3)
reply3 = input()
if reply3 in pos:
print('Nice choice.')
if reply1 and reply2 and reply2 in whole:
break
else:
print('Wrong input. Please type again.\n')
【问题讨论】:
-
你可能想看看不同的流量控制方法stackoverflow.com/questions/60208/…
标签: python if-statement while-loop