Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # jesus christ what is all of this
- # this is the kind of thing we were required to write according to Edexcel
- # apologies for those experiencing a heart attack right now
- '''
- QUIZ TIME
- '''
- # variable used to display standard 'wrong input' message
- nope = "I didn't quite get that. Mind trying again?"
- def runquiz():
- print("\nWelcome!") # just a welcome message
- name = str(input("What is your player name? ")) # username
- emailvalid = False # used to check if the entered email is valid
- while (emailvalid == False): # loopy loop
- email = str(input("What is your email address? ")) # email input
- if ('@' in email and '.' in email): # checks whether the input contains either '@' or '.'
- emailvalid == True # if that's the case, email is valid.
- break
- else:
- print(nope) # if not, it won't be accepted and will still require a valid email address before resuming
- age = int(input("How old are you? ")) # age
- gender = "" # gender placeholder
- while (gender != "Male" and gender != "Female"): # loopy loop
- gender_input = str(input("What gender are you? (M for male, F for female) "))
- if (gender_input == "M"):
- gender = "Male"
- break
- elif (gender_input == "F"):
- gender = "Female"
- break
- else:
- print(nope) # will keep asking for a valid input until input is either 'M' or 'F'
- print("\nName:", name, "\nEmail:", email, "\nAge:", age, "\nGender:", gender)
- corr_info = ""
- while (corr_info != "Y" and corr_info != "N"):
- correct = input("Is this information correct? (Y/N) ")
- if (correct == 'Y'):
- print("Registration complete!")
- corr_info = "Y"
- break
- elif (correct == 'N'):
- print("Let's try that again.")
- corr_info = "N"
- break
- else:
- print(nope)
- if (corr_info == "N"):
- runquiz()
- runquiz()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement