Guest User

Untitled

a guest
Apr 21st, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. """
  4.  
  5. This is my solution to question 3 for week 11 Assignment
  6. Made by: Patrick Augustin
  7.  
  8. """
  9.  
  10. import re
  11.  
  12. qty = 0
  13. username = ''
  14.  
  15. regexUsername = re.compile("[a-zA-Z]{5,10}$")
  16. regexQty = re.compile("[0-9]{1,2}$")
  17.  
  18.  
  19. while True:
  20. print("Please enter your username or press enter to exit!")
  21. username = raw_input("What is your username: ")
  22. if regexUsername.match(username):
  23. break
  24.  
  25. else:
  26.  
  27. print("Please see Admin for instructions!")
  28.  
  29.  
  30. while True:
  31. print("Please enter qty or press enter to exit")
  32. qty = raw_input("Please enter your quantity: ")
  33. if regexQty.match(qty):
  34. break
  35. else:
  36. print("Please see Admin for instructions!")
  37.  
  38. while True:
  39. username = raw_input("Please enter your username again, or press enter to exit: ")
  40.  
  41. if regexUsername.match(username):
  42. print("Thanks for playing " + username + ". Enjoy the rest of your semester.")
  43. sys.exit()
  44. else:
  45. print("All activities are logged. GOOD BYE!!!")
  46. sys.exit()
Add Comment
Please, Sign In to add comment