0
how to write a code so that user can choose a item in list by hitting a button on keyboard
import random print"Wellcome to the Mali Chef restaurant!!" menu = ["meal_1, meal_2, meal_3, meal_4] print"On todays menu is:",menu print "Choose which meal would you like to take: " random.choice(menu) if "meal_1": print"If you wish to eat meal_1 please enter num 1" input = ("Hit the button 1 for meal_1: ") print(menu[0]) How to get so that user can choose meal from menu,by hitting button on keyboard. Thank you..
3 Antworten
+ 1
any need importing random?
you could simply use a dictionary
0
Your tag says python3 but the code is python2
0
I'm still working in python 2.7, I correct it