Advertisement
Eddy_S

Untitled

May 4th, 2020
833
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.35 KB | None | 0 0
  1. def menu(message, accepted_vals):
  2.     selection = input(message)
  3.     while selection not in accepted_vals:
  4.         print(f"Are you sure you entered {' or '.join(accepted_vals)}? Try again.")
  5.         selection = input(message)
  6.     return selection
  7.  
  8.  
  9. accepted_vals = ["1", "2"]
  10. selection = menu("Enter '1' for spacebar and '2' for timer: ", accepted_vals)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement