Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- userFile=open("user.txt","a+")
- userFile.write("welcome to the amazing quiz ")
- close="no"
- while close != "yes":
- #this is the login code
- name =input("create a username: ")
- password =input("create a password: ")
- print("Thank you, you have now created a username and password.")
- command = None
- input1 = None
- input2= None
- while input1 !=name:
- input1 = input("enter your username to access the quiz: ")
- while input2 !=password:
- input2 = input("enter your password please to access the quiz: ")
- print("welcome to your quiz!")
- if name == name:
- print("Thank you, you will now be entered into the quiz")
- #this saves in to the text file userFile
- userFile.write(input("what is your first name? " ))
- userFile.write(input("what is your surname? " ))
- userFile.write(input("what is your age? " ))
- userFile.write(input("what is your year group? " ))
- userFile.write(input("what is your username? The username is made up from the first 3 letters of Their name and their age" ))
- #the difficulty the user wants
- difficulty=int(input(("What difficulty would you like to do the topic on 1=easy 2=medium 3=hard:")))
- if difficulty=='1':
- print("So you want to do a quiz on easy")
- print("Do you want to do it on Maths or Computer Science? If you want to do it on Maths type '1' if you want to do Computer Science type'2'")
- choice=input()
- if choice=='1':
- print("So you want to do Easy Maths")
- import easymaths
- elif choice=='2':
- print("So you want to do Easy Computer Science")
- import computersciencequestions
- elif difficulty=='2':
- print('So you want to do a quiz on medium')
- print("Do you want to do it on Maths or Computer Science? If you want to do it on Maths type '1' if you want to do Computer Science type'2'")
- if choice=='1':
- print('Medium maths')
- import mediummaths
- elif choice =='2':
- print("so you want to do medium quiz computer science")
- import computersciencequestions
- elif difficulty=='3':
- print('So you want to do a quiz on Hard')
- print("Do you want to do it on Maths or Computer Science? If you want to do it on Maths type '1' if you want to do Computer Science type'2'")
- if choice=='1':
- print('Medium maths')
- import mediummaths
- elif choice =='2':
- print("so you want to do medium quiz computer science")
- import computersciencequestions
- userFile.close()
- close=input("Thank you for taking part in the quiz,now Please type yes to exit the quiz\n")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement