So I have a function called start() and it has multiple if statements and I want all of them to run.

def start():
    print """You have just woken up from a very long nap.
    You find yourself in a dimly lit cave.
    There is a patch of light in the far distance above you. 
    There is a torch on the wall lighting the immediate area.
    There are dark passage ways in all directions."""
    
    decision = raw_input(prompt)
    if decision == "take torch":
        inventory.append(items[0])
        print "You took the torch."
        start_with_torch()   
    # if you don't take the torch, you can't go anywhere
    elif decision == "north" or "east" or "west" or "south" and not 'torch' in inventory:
        print "It is too dark to see in the tunnel."
    # python skips this.
    if decision == "north" and 'torch' in inventory:
        sphinx_room()

Is there a way to make python run through that if statement even if the first statement it encounters is true?

EDIT: Okay, that was dumb. I should've put another raw_input to take in the user's input.
D'OH

This statement will always yield True

elif decision == "north" or "east" or "west"
#
#It breaks down to 
    elif decision == "north" 
         or "east" 
         or "west"

and both "east" and "west" are not empty strings so either will evaluate to True. Instead use

elif decision in ["north", "east", "west"]:
commented: That was really helpful! +1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.