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ループをどのように終了する予定ですか?あなたは 'exitとexit1'にのみfalseを割り当てているので? +あなたは、不便なコメントにあなたが何をしたいかを伝えることのほかにあなたの問題は何か言及していませんでした... –
このスクリプトは何をすべきでしょうか? –
ちょうどヒントとして: 'continue'と' break'ステートメントは、次の繰り返しでループを続行するか、または中断するために使用できます。 – Dschoni