Advertisement
Guest User

Untitled

a guest
Sep 30th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.24 KB | None | 0 0
  1. import time
  2. score = 0
  3.  
  4. print("welcome to the quiz!")
  5. time.sleep(1)
  6. print("please register to play")
  7. time.sleep(1)
  8.  
  9. username = input("please enter your username: ")
  10. password = input("please enter your password: ")
  11.  
  12. filename = "output.txt"
  13. text_file = open(filename, 'w')
  14. text_file.write("Username: " + username)
  15. text_file.write("n")
  16. text_file.write("Password: " + password)
  17. text_file.close()
  18.  
  19. difficulty = input("please choose between Easy, Medium and Hard difficulty: ")
  20. if difficulty == "Easy" and difficulty == "easy":
  21. print("You have chosen the easy game-mode, Good luck!")
  22. time.sleep(1)
  23. question1easy = input("What is the capital of england? ")
  24. if question1easy == "United Kingdom" or "united kingdom":
  25. score = score + 1
  26. time.sleep(1)
  27. question2easy = input("What is the time? ")
  28. if question2easy == "23:00":
  29. score = score + 1
  30. time.sleep(1)
  31. question3easy = input("When will i finish my gcses? ")
  32. if question3easy == "May 2018":
  33. score = score + 1
  34. time.sleep(1)
  35. question4easy = input("When is my bday? ")
  36. if question4easy == "March 31st":
  37. score = score + 1
  38. time.sleep(1)
  39. print("Final question!")
  40. time.sleep(1)
  41. question5easy = input("When is my bday? ")
  42. if question5easy == "March 31st":
  43. score = score + 1
  44. text_file = open(filename, 'a')
  45. text_file.write("nYou scored: " + str(score)) # str() changes integer value to string to be saved into a file
  46. text_file.close()
  47.  
  48. elif difficulty == "medium" or difficulty == "Medium":
  49. print("You have chosen the medium game-mode, Good luck!")
  50. time.sleep(1)
  51. question1medium = input("What is the capital of Lithuania? ")
  52. if question1medium == "Vilnius" or question1medium == "vilnius":
  53. score = score + 1
  54. time.sleep(1)
  55. question2medium = input("When did I get my new PC? ")
  56. if question2medium == "Yesterday" or question2medium == "yesterday":
  57. score = score + 1
  58. time.sleep(1)
  59. question3medium = input("What day is it today? ")
  60. if question3medium == "Saturday" or question3medium == "saturday":
  61. score = score + 1
  62. time.sleep(1)
  63. text_file = open(filename, 'a')
  64. text_file.write("nYou scored: " + str(score))
  65. text_file.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement