vendredi 2 septembre 2016

Going through "Learn Python the hard way." Stuck on ex36. Having issues with an if statement [duplicate]

This question already has an answer here:

I'll just ask for help on this one function but so far all my functions are having similar issues and I think it has to do with my if statements.

Here's the function:

def cosby_room():
print "You enter a dark room and there is someone sitting alone on a couch."
print "Oh. It's Bill Cosby. What do ya know?"
print "He offers you a drink..."
print "Do you stay or leave?"

choice = raw_input("> ")

if "run" or "flee" or "leave" or "dart" or "get out" in choice:
    print "Phew! That was close."
    start()
elif "stay" or "drink" in choice:
    print "You take a sip."
    print "Everything starts to get all confusing."
    print "Bill whispers something in your ear..."
    print "You pass out and wake up in a park with a strange ache in your butt."
    game_over("At least it'll make for an interesting story.")
else: 
    cosby_room()

So as of now if I run this function, no matter how input for choice, it goes down the first 'if' branch. Even if I type "stay" or "leave" I go down the first branch. I'm not really sure why or what's going on.. Can anyone help me out with this one?

Aucun commentaire:

Enregistrer un commentaire