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