Advertisement
Guest User

Untitled

a guest
Feb 2nd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.21 KB | None | 0 0
  1. userFile=open("user.txt","a+")
  2. userFile.write("welcome to the amazing quiz ")
  3.  
  4. close="no"
  5. while close != "yes":
  6. #this is the login code
  7. name =input("create a username: ")
  8. password =input("create a password: ")
  9. print("Thank you, you have now created a username and password.")
  10. command = None
  11. input1 = None
  12. input2= None
  13.  
  14. while input1 !=name:
  15. input1 = input("enter your username to access the quiz: ")
  16. while input2 !=password:
  17. input2 = input("enter your password please to access the quiz: ")
  18. print("welcome to your quiz!")
  19. if name == name:
  20. print("Thank you, you will now be entered into the quiz")
  21.  
  22.  
  23.  
  24.  
  25. #this saves in to the text file userFile
  26. userFile.write(input("what is your first name? " ))
  27. userFile.write(input("what is your surname? " ))
  28. userFile.write(input("what is your age? " ))
  29. userFile.write(input("what is your year group? " ))
  30. userFile.write(input("what is your username? The username is made up from the first 3 letters of Their name and their age" ))
  31.  
  32.  
  33. #the difficulty the user wants
  34. difficulty=int(input(("What difficulty would you like to do the topic on 1=easy 2=medium 3=hard:")))
  35. if difficulty==1:
  36. print("So you want to do a quiz on easy")
  37.  
  38. elif difficulty==2:
  39. print("So you want to do a quiz on medium")
  40.  
  41. elif difficulty==3:
  42. print ("So you want to have a quiz on hard")
  43. else:
  44. print ("Not from selection")
  45.  
  46. #users choice of quiz
  47. user_subject=int(input(("Which quiz would you like to do 1=maths 2=computer science: ")))
  48. if user_subject==1:
  49. print("This is the quiz for maths")
  50. import questionsmaths
  51. print("You scored",score,"/5 well done")
  52.  
  53. if score==1:
  54. print("You got 1 out of 5, that is a grade 1")
  55. elif score==2:
  56. print("You got 2 out of 5, thats a grade 2")
  57. elif score==3:
  58. print("You got 3 out of 5, you got a grade 3")
  59. elif score==4:
  60. print("You got 4 out of 5, thats a grade 4")
  61. elif score==5:
  62. print("You got 5 out of 5, thats a grade 9")
  63.  
  64. close=input("Please type yes to exit the quiz\n")
  65.  
  66.  
  67. #computer science quiz questions
  68.  
  69. elif user_subject==2:
  70. print("This is the quiz for computer science")
  71. score=0
  72. import questionscomputerscience
  73.  
  74. if score==1:
  75. print("You got 1 out of 5, that is a grade 1")
  76. elif score==2:
  77. print("You got 2 out of 5, thats a grade 2")
  78. elif score==3:
  79. print("You got 3 out of 5, you got a grade 3")
  80. elif score==4:
  81. print("You got 4 out of 5, thats a grade 4")
  82. elif score==5:
  83. print("You got 5 out of 5, thats a grade 9")
  84.  
  85. userFile.close()
  86.  
  87.  
  88. 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