igogiko

Untitled

Sep 8th, 2012
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.58 KB | None | 0 0
  1. options1 = ["Yes", "No"]
  2.  
  3. def options():
  4.     print 'Welcome to my Login System'
  5.    
  6.     while True:
  7.       option = raw_input("Would you like to view the username list? (Yes/No) : ")
  8.      
  9.       if option == options1[0]: # Case it's "Yes"
  10.           print "User typed 'Yes'"
  11.           break # Exit the loop
  12.       elif option == options1[1]: # Case it's "No"
  13.           print "User typed 'No'"
  14.           break # Exit the loop
  15.       else: # Case it's anything else
  16.           print "Learn to type!"
  17.           # No break here, ask user again
  18.  
  19. options()
  20. print "\nProgram ended"
Advertisement
Add Comment
Please, Sign In to add comment