标签:inpu ase play pre enc 分享图片 str tle oom
不涉及函数应用
1 Food_list = { 2 ‘pizza‘: [‘cheese‘, ‘onion‘, ‘green_papper‘, ‘mushroom‘], 3 ‘hamburger‘: [‘beef‘, ‘pork‘, ‘chicken‘, ‘lettuce‘, ‘tomato‘, ‘cheese‘, ‘onion‘, ‘cucumber‘], 4 ‘pasta‘: [‘fish‘, ‘beef‘, ‘onion‘, ‘basil‘, ‘meatball‘, ‘black_papper‘], 5 ‘fried_chicken‘: [‘leg‘, ‘wings‘, ‘breast‘, ‘chili‘, ‘papper‘], 6 ‘ice_cream‘: [‘vanilla‘, ‘Chocolate‘, ‘strawbarry‘, ‘banana‘], 7 ‘french_fries‘: [‘small_portion‘, ‘medium‘, ‘large_portion‘], 8 ‘cake‘: [‘cream‘, ‘chocolate‘, ‘mango‘, ‘toon‘], 9 ‘drinks‘: [‘cola‘, ‘sprite‘, ‘coffee‘, ‘milkshake‘] 10 } 11 # print menu 12 for key in Food_list.keys(): 13 print(key.title()) 14 choice = input(‘Please choose you favorite food:\n‘) 15 16 Food_select = { 17 ‘pizza‘: [], 18 ‘hamburger‘: [], 19 ‘pasta‘: [], 20 ‘fried_chicken‘: [], 21 ‘ice_cream‘: [], 22 ‘french_fries‘: [], 23 ‘cake‘: [], 24 ‘drinks‘: [] 25 } 26 Drop_out = True 27 # Enter a list according to the user 28 while Drop_out: 29 if choice.isalpha(): 30 if choice == ‘q‘: 31 for key in list(Food_select.keys()): 32 if not Food_select.get(key): 33 del Food_select[key] 34 print(Food_select) 35 Drop_out = False 36 break 37 elif choice == ‘b‘: 38 print(‘You have returned to the top‘) 39 else: 40 # choice = choice.title() 41 print(Food_list[choice]) 42 choice2 = input( 43 ‘Please choose the ingredients you like:\nDrop out:q\nReturn to superior:b\n‘) 44 if choice2.isalpha(): 45 if choice2 == "q": 46 for key in list(Food_select.keys()): 47 if not Food_select.get(key): 48 del Food_select[key] 49 print(Food_select) 50 Drop_out = False 51 break 52 elif choice2 == "b": 53 for key in Food_list.keys(): 54 print(key) 55 choice = input(‘Please choose you favorite food:\n‘) 56 else: 57 while choice2 in Food_list[choice]: 58 Food_select[choice].append(choice2) 59 print(Food_select[choice]) 60 61 if choice2 not in Food_list[choice]: 62 print(‘Please select according to the ingredient list!‘) 63 break 64 else: 65 print(‘Please follow the menu order!‘) 66 67 else: 68 print(‘Please follow the menu order!‘)
标签:inpu ase play pre enc 分享图片 str tle oom
原文地址:https://www.cnblogs.com/SkyQQ/p/10114069.html