Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- score = 0
- print("welcome to the quiz!")
- time.sleep(1)
- print("please register to play")
- time.sleep(1)
- username = input("please enter your username: ")
- password = input("please enter your password: ")
- filename = "output.txt"
- text_file = open(filename, 'w')
- text_file.write("Username: " + username)
- text_file.write("n")
- text_file.write("Password: " + password)
- text_file.close()
- difficulty = input("please choose between Easy, Medium and Hard difficulty: ")
- if difficulty == "Easy" and difficulty == "easy":
- print("You have chosen the easy game-mode, Good luck!")
- time.sleep(1)
- question1easy = input("What is the capital of england? ")
- if question1easy == "United Kingdom" or "united kingdom":
- score = score + 1
- time.sleep(1)
- question2easy = input("What is the time? ")
- if question2easy == "23:00":
- score = score + 1
- time.sleep(1)
- question3easy = input("When will i finish my gcses? ")
- if question3easy == "May 2018":
- score = score + 1
- time.sleep(1)
- question4easy = input("When is my bday? ")
- if question4easy == "March 31st":
- score = score + 1
- time.sleep(1)
- print("Final question!")
- time.sleep(1)
- question5easy = input("When is my bday? ")
- if question5easy == "March 31st":
- score = score + 1
- text_file = open(filename, 'a')
- text_file.write("nYou scored: " + str(score)) # str() changes integer value to string to be saved into a file
- text_file.close()
- elif difficulty == "medium" or difficulty == "Medium":
- print("You have chosen the medium game-mode, Good luck!")
- time.sleep(1)
- question1medium = input("What is the capital of Lithuania? ")
- if question1medium == "Vilnius" or question1medium == "vilnius":
- score = score + 1
- time.sleep(1)
- question2medium = input("When did I get my new PC? ")
- if question2medium == "Yesterday" or question2medium == "yesterday":
- score = score + 1
- time.sleep(1)
- question3medium = input("What day is it today? ")
- if question3medium == "Saturday" or question3medium == "saturday":
- score = score + 1
- time.sleep(1)
- text_file = open(filename, 'a')
- text_file.write("nYou scored: " + str(score))
- text_file.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement