Advertisement
Guest User

OH GOD THIS IS ABSOLUTELY AWFUL

a guest
Dec 3rd, 2015
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.03 KB | None | 0 0
  1. # jesus christ what is all of this
  2. # this is the kind of thing we were required to write according to Edexcel
  3. # apologies for those experiencing a heart attack right now
  4.  
  5. '''
  6. QUIZ TIME
  7. '''
  8.  
  9. # variable used to display standard 'wrong input' message
  10. nope = "I didn't quite get that. Mind trying again?"
  11.  
  12. def runquiz():
  13.    
  14.     print("\nWelcome!") # just a welcome message
  15.  
  16.     name = str(input("What is your player name? ")) # username
  17.  
  18.     emailvalid = False # used to check if the entered email is valid
  19.    
  20.     while (emailvalid == False): # loopy loop
  21.         email = str(input("What is your email address? ")) # email input
  22.         if ('@' in email and '.' in email): # checks whether the input contains either '@' or '.'
  23.             emailvalid == True # if that's the case, email is valid.
  24.             break
  25.         else:
  26.             print(nope) # if not, it won't be accepted and will still require a valid email address before resuming
  27.    
  28.     age = int(input("How old are you? ")) # age
  29.  
  30.     gender = "" # gender placeholder
  31.    
  32.     while (gender != "Male" and gender != "Female"): # loopy loop
  33.         gender_input = str(input("What gender are you? (M for male, F for female) "))
  34.         if (gender_input == "M"):
  35.             gender = "Male"
  36.             break
  37.         elif (gender_input == "F"):
  38.             gender = "Female"
  39.             break
  40.         else:
  41.             print(nope) # will keep asking for a valid input until input is either 'M' or 'F'
  42.  
  43.     print("\nName:", name, "\nEmail:", email, "\nAge:", age, "\nGender:", gender)
  44.  
  45.     corr_info = ""
  46.     while (corr_info != "Y" and corr_info != "N"):
  47.         correct = input("Is this information correct? (Y/N) ")
  48.         if (correct == 'Y'):
  49.             print("Registration complete!")
  50.             corr_info = "Y"
  51.             break
  52.         elif (correct == 'N'):
  53.             print("Let's try that again.")
  54.             corr_info = "N"
  55.             break
  56.         else:
  57.             print(nope)
  58.  
  59.     if (corr_info == "N"):
  60.         runquiz()
  61.    
  62. runquiz()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement