Advertisement
gruntfutuk

Simple menu system in Python

Nov 20th, 2017
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.65 KB | None | 0 0
  1. # a simple menu system
  2.  
  3. while True:
  4.    
  5.     # menu choices
  6.     print("\n\nSelection one of the options below by entering the letter.\n")
  7.     print('a\tif you want an apple')
  8.     print('b\tif you want a banana')
  9.     print('c\tif you want a cherry')
  10.     print('or\tjust press ENTER to exit\n')
  11.     option = input("Enter your choice:").lower()
  12.     print()
  13.    
  14.     # actions
  15.     if not option:
  16.         break
  17.     elif option == "a":
  18.         print('Have an apple.')
  19.     elif option == "b":
  20.         print('Have a banana')
  21.     elif option == "c":
  22.         print('Have a cherry')
  23.     else:
  24.         print('Sorry, that was not a valid option. Try again.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement