Advertisement
gruntfutuk

simpleinputloop

Feb 25th, 2018
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.34 KB | None | 0 0
  1. # some code doing stuff
  2. while True:
  3.     # more code doing stuff
  4.     # maybe print a menu and ask for options
  5.     choice = input('Some prompt: ')
  6.     if choice == "choice 1":
  7.         pass  # do some stuff
  8.     elif choice == "choice 2":
  9.         pass  # do some stuff
  10.     elif choice == 'let me out':
  11.         break
  12.     else:
  13.         print('That choice is not available. Please try again.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement