Multi-level menu exercises

Three-level menu

  1. Print a menu, select items
  2. Print the secondary menu, select items
  3. After printing three-level menu, select the item to exit the program
  4. B return to the previous menu selection
  5. Select q to exit the program
= {the MENU 
"barbecue": {
"beef": [ "cow streaky", "cow rib"],
"lamb": [ "Kebab", "big fat kidneys"],
"fish": [ "grilled salmon head "," roast saury "]
},
" sushi ": {
" sushi ": [" salmon sushi "," tuna sushi "],
" sushi ship ": [" salmon ship "," ship tuna " ],
"sashimi": [ "sashimi tuna", "red shell sashimi"]
},
"beverage": {
"wine": [ "Bordeaux", "Cabernet Sauvignon"],
"beer": [ "Asahi", "Kirin"],
"sake": [ "The pine", "burning taro"]
}

}
the while True:
for I in MENU:
Print (i)
Choice1 the INPUT = ( "Enter your choice: (q Exit)")
IF Choice1 in the MENU:
the while True:
for i2 in the MENU [Choice1]:
Print (i2)
choice2 = input ( "Enter your choice: (b returns q to quit)")
IF Choice2 in MENU [Choice1]:
the while True:
for I3 in MENU [Choice1] [Choice2]:
Print (I3)
Choice3 = INPUT ( "input your selection: (b q return quit) ")
IF Choice3 == 'B':
BREAK
elif Choice3 == 'q':
exit ()
the else:
Print (" you point S% "Choice3%)
BREAK
elif Choice2 = = 'B':
BREAK
the else:
quit ()
the else:
quit()

 

Guess you like

Origin www.cnblogs.com/goldtree358/p/11606114.html