私は中断した内側のループだけを終了したいと思います。継続作業を使用して、しかし、私は休憩が内側のループを終了すると考えていたが、それは全体のプログラムを終了するようだ。休憩とは何ですか?内側のループのpythonを中断する
counter = 0
while counter == 0:
print "You enter a dark room with two doors. Do you go through door #1 or door #2?"
door = raw_input("> ")
if door == "1":
print "There's a giant bear here eating a cheese cake. What do you do?"
print "1. Take the cake."
print "2. Scream at the bear."
bear = raw_input("> ")
if bear == "1":
print "The bear eats your face off. Good job!"
elif bear == "2":
print "The bear eats your legs off. Good job!"
else:
print "Well, doing %s is probably better. Bear runs away." % bear
break
else:
print "You stumble around and fall on a knife and die. Good job!"
'if'文はループではないので、' break'は外側の 'while'ループにのみ適用されます。 – Marius
[ここ](http://www.tutorialspoint.com/python/python_break_statement.htm)をチェックすると、 'if'はループではないので、' break'は 'while'全体を破ります。 – co2y
これはかなり病的です。 – BradTheBrutalitist