Advertisement
Eddy_S

Untitled

May 4th, 2020
744
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. def menu():
  2.     while True:
  3.         try:
  4.             selection = int(input("Enter 1 for spacebar and 2 for timer: "))
  5.             if selection not in [1, 2]:
  6.                 raise ValueError
  7.             return selection
  8.         except ValueError:
  9.             print("Are you sure you entered 1 or 2? Try again.")
  10.             continue
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement