Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- """
- This is my solution to question 3 for week 11 Assignment
- Made by: Patrick Augustin
- """
- import re
- qty = 0
- username = ''
- regexUsername = re.compile("[a-zA-Z]{5,10}$")
- regexQty = re.compile("[0-9]{1,2}$")
- while True:
- print("Please enter your username or press enter to exit!")
- username = raw_input("What is your username: ")
- if regexUsername.match(username):
- break
- else:
- print("Please see Admin for instructions!")
- while True:
- print("Please enter qty or press enter to exit")
- qty = raw_input("Please enter your quantity: ")
- if regexQty.match(qty):
- break
- else:
- print("Please see Admin for instructions!")
- while True:
- username = raw_input("Please enter your username again, or press enter to exit: ")
- if regexUsername.match(username):
- print("Thanks for playing " + username + ". Enjoy the rest of your semester.")
- sys.exit()
- else:
- print("All activities are logged. GOOD BYE!!!")
- sys.exit()
Add Comment
Please, Sign In to add comment