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..

20th May 2018, 1:16 PM
Majdak84
Majdak84 - avatar
3 ответов
+ 1
any need importing random? you could simply use a dictionary
20th May 2018, 2:18 PM
E_E Mopho
E_E Mopho - avatar
0
Your tag says python3 but the code is python2
20th May 2018, 1:25 PM
Bebida Roja
Bebida Roja - avatar
0
I'm still working in python 2.7, I correct it
20th May 2018, 1:28 PM
Majdak84
Majdak84 - avatar