0
我在while循环的简单代码中遇到问题。我的问题在代码注释中解释。返回代码while循环
CODE
exit = False
while not exit:
choice = input("Test ")
if choice== 1:
print "hello"
exit = False
else:
print "good morning"
#I want to return to the first while with the input Test but I pass to the second while
exit = False
exit1 = False
while not exit1:
choice = input("Test 1")
if choice== 1:
print "bye"
exit1 = False
else:
print "good evening"
#I want to return to the first while with the input Test but I return to the second while
exit = False
非常感谢。
你打算如何退出while循环?因为您只将false指定为'exit和exit1'? +你没有提到什么是你的问题旁边告诉你想要什么,在评论中是不方便的... –
这个剧本应该做什么? –
就像一个提示:'continue'和'break'语句可以用来在下一次迭代时继续循环或者打破它。 – Dschoni