S
skwyang93
1. bear_moved = False
2.
3. while True:
4. next = raw_input("> ")
5.
6. if next == "take honey":
7. dead("The bear looks at you then slaps your face off.")
8. elif next == "taunt bear" and not bear_moved:
9. print "The bear has moved from the door. You can go through."
10.
11. bear_moved = True
12. elif next == "taunt bear" and bear_moved:
13. dead("The bear gets pissed off and chews your leg off.")
14. elif next == "open door" and bear_moved:
15. gold_room()
16. else:
17. print "I got no idea what that means.
# This is just to show my understanding of Boolean. In line 8-9, if my input is "taunt bear", the result is true and true, which will continue the loop.
# So what confused me is line 12-13. if my input is taunt bear, is it suppose to be taunt bear == "taunt bear" and bear_moved which is true and true? which means the loop will continue instead of cancelling it.
Thanks in advance for spending your time to answer my question.
Source: Learnpythonthehardway
2.
3. while True:
4. next = raw_input("> ")
5.
6. if next == "take honey":
7. dead("The bear looks at you then slaps your face off.")
8. elif next == "taunt bear" and not bear_moved:
9. print "The bear has moved from the door. You can go through."
10.
11. bear_moved = True
12. elif next == "taunt bear" and bear_moved:
13. dead("The bear gets pissed off and chews your leg off.")
14. elif next == "open door" and bear_moved:
15. gold_room()
16. else:
17. print "I got no idea what that means.
# This is just to show my understanding of Boolean. In line 8-9, if my input is "taunt bear", the result is true and true, which will continue the loop.
# So what confused me is line 12-13. if my input is taunt bear, is it suppose to be taunt bear == "taunt bear" and bear_moved which is true and true? which means the loop will continue instead of cancelling it.
Thanks in advance for spending your time to answer my question.
Source: Learnpythonthehardway