like for a regular menu it would be:

def menu(list, question):
for entry in list:
print 1 + list.index(entry),
print ") " + entry

return input(question) - 1

items = ["bookcase", "sleeping dog", "couch", "closet", "rug", "door"]

How to create a menu to where when you entered 1 for bookcase it went into another menu

items = ["read", "throw away", "etc"]

And how to use it during programs

Edited 6 Years Ago by cc11rocks: n/a

You may want to use a dictionary. Here is a simple example ...

def select_action(choice):
    print "You now can do the following:"
    for action in menu_items[choice]:
        print action 
    # ask for action choice ...
    action_choice = raw_input("Select an action: ")
    return action_choice


# create a dictionary of menu:submenu pairs
menu_items = {
"bookcase": ["read", "sell", "keep"], 
"couch": ["sit", "look under", "lift pillow"], 
"door": ["open", "lock", "touch"]
}

print "You enter a room and see:"
for item in menu_items:
    print item

choice = raw_input("Which item do you want to investigate? ")
action = select_action(choice)
# do something with the selected action
print action  # test
This question has already been answered. Start a new discussion instead.