Share your repls and programming experiences

← Back to all posts
asiyaaa (1)

Write a program that presents a simple menu to the user: 1. Play Game 2. Instructions 3. Quit
#The program should ask the user for a number between 1 and 3 and will output “Let’s go” only when a valid entry is made, repeating the menu selection until a valid entry is made.

DynamicSquid (4621)
print("1. option 1\n2. option 2\n3. option 3\n")

user_input = input("What option would you like?")

while user_input > 3: # checks for valid input
  print("Please enter 1, 2, or 3")
  user_input = input("")

if user_input == 1:
  # do something

Hope this helps! And don't forget to mark this as accepted :)