I'm trying to make a text-based game in Python, however, code could get out of hand pretty quickly if I can't do one thing on one line.

First, the source code:

```
from sys import exit

prompt = "> "
inventory = []

def menu():
    while True:
        print "Enter \"start game\" to start playing."
        print "Enter \"password\" to skip to the level you want."
        print "Enter \"exit\" to exit the game."
        choice = raw_input(prompt)
        if choice == "start game":
            shell()
        elif choice == "password":
            password()
        elif choice == "exit":
            exit(0)
        else:
            print "Input invalid. Try again."

def password():
    print "Enter a password."
    password = raw_input(prompt)
    if password == "go back":
        print "Going to menu..."
    else:
        print "Wrong password. You are trying to cheat by (pointlessly) guess passwords."
        dead("cheating")

def shell(location="default", item ="nothing"):
    if location == "default" and item == "nothing":
        print "Starting game..."
        # starter_room (disabled until room is actually made)
    elif location != "default" and item != "nothing":
        print "You picked up %s." % item
        inventory.append(item)
        location()
    elif location != "default" and item == "nothing":
        print "You enter the room."
        location()
    else:
        print "Error: Closing game."

def location():
    print "Nothing to see here."
    # Placeholder location so the script won't spout errors.

def dead(reason):
    print "You died of %s." % reason
    exit(0)

print "Welcome."
menu()

```

First, an explanation on how my game basically works.
The game has a 'shell' (where input is done) which receives information from and sends information to the different 'rooms' in the game, and it stores the inventory. It can receive two arguments, the location and an eventual item to be added to the inventory. However, line 40-42 (the first elif block in 'shell') and line 43-45 (the last elif block in 'shell') are supposed to go back to whatever location the location was (line 42 and 45, to be exact). I've tried "%s() % location" but that doesn't work, it seems to only work when printing things or something.

Is there any way to do this? If not, even writing an engine for this game would be a nightmare. Or I'd have to make an entirely different engine, which I think would be a way better approach in such a case.

Sorry if I made any mistakes, first question/post ever.