I am working through Exercise 35 of Learn Python The Hard Way (LPTHW).
http://learnpythonthehardway.org/book/ex35.html
I am struggling with one of the study drills of this exercise. Specifically "Add more to the game".
Here is the code that is returning the error:
def bear_room(): # A new encounter
print "There is a bear here."
print "The bear has a bunch of honey."
print "The fat bear is in front of another door."
print "How are you going to move the bear?"
bear_moved = False
while True:
next = str(raw_input("> "))
if ["honey", "take"] in next:
dead("The bear peers at you for a moment, sizing you up, then claws your face off.")
elif ["taunt", "lure", "yell", "scream", "shout"] in next:
print "the bear has moved from the door. You can go through it now."
bear_moved = True
elif ["taunt", "lure", "yell", "scream", "shout"] in next and bear_moved:
dead("The bear gets pissed off and chews your leg off.")
elif ["open", "door", "next", "through", "onward"] in next and bear_moved:
gold_room()
else:
print "I got not idea what that means."
It's
next in ["taunt", "lure", "yell", "scream", "shout"]
not
["taunt", "lure", "yell", "scream", "shout"] in next
You have the test backwards.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With