I am very new to python. I am trying to learn by making a text based game. In the gameplay I am wanting a variable, door_open, to begin false but once unlocked door_open = True. The next time the function is called a different message would be displayed.
door_open =False
def house():    
    print "The door is locked"
    plan = raw_input(">")
    if plan.lower() == 'use key':
            inventory.remove("House Key")
        door_open = True
        print "You are inside"
        start() ## this just returns to the starting point outside
    if door_open == True:
        print "You walk inside"
        exit(0) ## using this until I develop it more 
    else:
        print "Door is locked. Do you want to use your key (Y/N)?"
 
     
     
     
     
    