0

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: "

secure_random = random.SystemRandom()

print(secure_random.choice(menu))

How to write a code so that a user can choose meal by pushing a button on keyboard?

Ivan M
  • 147
  • 1
  • 2
  • 8
  • Why random ? Does the customer receive random food after pressing the same button ? Or do you want there to be 4 buttons or LIST and the customer chooses one of the meals (No. 1 - 4) ? What should be output from the function (text or number of the meal) ? – s3n0 May 20 '18 at 16:03
  • If it is a button on the KEYBOARD, use the `for event in pygame.event.get():` loop. There is an event for keypresses. Look at this for help: https://stackoverflow.com/a/16044380/7313664 – SnootierBaBoon May 20 '18 at 18:00

0 Answers0