Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- def welcome():
- print("------------Welcome to THE QUIZ!------------")
- time.sleep(0.5)
- accountCreate = input("Hit Y to create an account!\nHit Q to quit the quiz!\n")
- if accountCreate == 'Y' or accountCreate == 'y':
- account()
- if accountCreate == 'N' or accountCreate == 'n':
- quit()
- def account():
- try:
- f = open("account.txt",'w+')
- except:
- f = open("account.txt",'a')
- print("OK! Here are a few questions!\n")
- time.sleep(0.5)
- firstName = input("Firstname: ")
- time.sleep(0.5)
- surname = input("Surname: ")
- time.sleep(0.5)
- age = input("Age: ")
- time.sleep(0.5)
- usernameAsk = print("You username is: ",firstName[0:3]+age)
- username = firstName[0:3]+age
- time.sleep(0.5)
- password = input("Password: ")
- time.sleep(0.5)
- confirm = input("Confirm Password: ")
- while password != confirm:
- print("INVALID! Please re-enter your password!\n")
- time.sleep(0.5)
- password = input("Password: ")
- time.sleep(0.5)
- confirm = input("Confirm Password: ")
- f.write(firstName + ' , ' + surname + ' , ' + age + '\n\nUsername: ' + username + '\nPassword: ' + confirm)
- fRead= f.readlines()
- edit = input('Would you like to edit your details?Y/N\n')
- if edit == 'Y' or edit == 'y':
- account()
- else:
- topics()
- def topics():
- """with open('packages.txt') as f:
- for i, line in enumerate(f, 1):
- if i == num:
- break
- print line"""
- topicChoice = input("Would you like to be tested on Maths\nor Geography?M/G\n")
- difficulty = int(input("Select difficulty:\n1.Easy\n2.Medium\n3.Hard\nSelect 1 , 2 or 3\n"))
- if topicChoice == 'M' or topicChoice == 'm' and difficulty == 1:
- maths_1()
- elif topicChoice == 'M' or topicChoice == 'm' and difficulty == 2:
- maths_2()
- elif topicChoice == 'M' or topicChoice == 'm' and difficulty == 3:
- maths_3()
- elif topicChoice == 'G' or topicChoice == 'g' and difficulty == 1:
- geo_1()
- elif topicChoice == 'G' or topicChoice == 'g' and difficulty == 2:
- geo_2()
- elif topicChoice == 'G' or topicChoice == 'g' and difficulty == 3:
- geo_3()
- def maths_1():
- cont = 5
- print("You have chosen Maths Easy! Here you go!")
- m = open("maths.txt",'r')
- lines = m.readlines()
- time.sleep(0.5)
- print(lines[0])
- q1 = int(input())
- if q1 != 9:
- time.sleep(0.5)
- #print("WRONG!") #Try Again:")
- cont -= 1
- time.sleep(0.5)
- print(lines[1])
- q2 = int(input())
- if q2 != 30:
- time.sleep(0.5)
- #print("WRONG!") #Try Again:")
- cont -= 1
- time.sleep(0.5)
- print(lines[2])
- q3 = int(input())
- if q3 != 63:
- time.sleep(0.5)
- #print("WRONG!") #Try Again:")
- cont -= 1
- time.sleep(0.5)
- print(lines[3])
- q4 = int(input())
- if q4 != 24:
- time.sleep(0.5)
- #print("WRONG!") #Try Again:")
- cont -= 1
- time.sleep(0.5)
- print(lines[4])
- q5 = int(input())
- if q5 != 22:
- #print("WRONG!") #Try Again:")
- cont -= 1
- time.sleep(0.5)
- score = (cont/5)*100
- #print("You score out of 5 is ", 5 - cont)
- print("Your score is ", score, '%')
- time.sleep(0.5)
- again = input("Would you like to take another quiz?Y/N")
- if again == 'Y' or again == 'y':
- topics()
- else:
- quit()
- def maths_2():
- cont = 5
- print("You have chosen Maths Medium! Here you go!")
- m2 = open("maths2.txt",'r')
- lines = m2.readlines()
- time.sleep(0.5)
- print(lines[0])
- q1 = int(input())
- if q1 != 5:
- time.sleep(0.5)
- #print("WRONG!") #Try Again:")
- cont -= 1
- time.sleep(0.5)
- print(lines[1])
- q2 = int(input())
- if q2 != 48:
- time.sleep(0.5)
- #print("WRONG!") #Try Again:")
- cont -= 1
- time.sleep(0.5)
- print(lines[2])
- q3 = int(input())
- if q3 != 256:
- time.sleep(0.5)
- #print("WRONG!") #Try Again:")
- cont -= 1
- time.sleep(0.5)
- print(lines[3])
- q4 = int(input())
- if q4 != 400:
- time.sleep(0.5)
- #print("WRONG!") #Try Again:")
- cont -= 1
- time.sleep(0.5)
- print(lines[4])
- q5 = int(input())
- if q5 != 100:
- time.sleep(0.5)
- #print("WRONG!") #Try Again:")
- cont -= 1
- time.sleep(0.5)
- score = (cont/5)*100
- #print("You score out of 5 is ", 5 - cont)
- print("Your score is ", score, '%')
- time.sleep(0.5)
- again = input("Would you like to take another quiz?Y/N\n")
- if again == 'Y' or again == 'y':
- topics()
- else:
- quit()
- def maths_3():
- cont = 5
- print("You have chosen Maths Hard! Here you go!")
- m3 = open("maths3.txt",'r')
- lines = m3.readlines()
- time.sleep(0.5)
- print(lines[0])
- q1 = int(input())
- if q1 != 2:
- time.sleep(0.5)
- #print("WRONG!") #Try Again:")
- cont -= 1
- time.sleep(0.5)
- print(lines[1])
- q2 = float(input())
- if q2 != 0.3:
- time.sleep(0.5)
- #print("WRONG!") #Try Again:")
- cont -= 1
- time.sleep(0.5)
- print(lines[2])
- q3 = float(input())
- if q3 != 25.5:
- time.sleep(0.5)
- #print("WRONG!") #Try Again:")
- cont -= 1
- time.sleep(0.5)
- print(lines[3])
- q4 = int(input())
- if q4 != 1:
- time.sleep(0.5)
- #print("WRONG!") #Try Again:")
- cont -= 1
- time.sleep(0.5)
- print(lines[4])
- q5 = int(input())
- if q5 != 3:
- time.sleep(0.5)
- #print("WRONG!") #Try Again:")
- cont -= 1
- time.sleep(0.5)
- score = (cont/5)*100
- #print("You score out of 5 is ", 5 - cont)
- print("Your score is ", score, '%')
- time.sleep(0.5)
- again = input("Would you like to take another quiz?Y/N\n")
- if again == 'Y' or again == 'y':
- topics()
- else:
- quit()
- def geo_1():
- cont = 5
- print("You have chosen Geograohy Easy! Here you go!")
- g = open("geography.txt",'r')
- lines = g.readlines()
- time.sleep(0.5)
- print(lines[0]+'\n1. Tokoyo\n2. Dehli\n3. Bangkok\nEnter choice number: ')
- q1 = int(input())
- if q1 != 1:
- time.sleep(0.5)
- #print("WRONG!") #Try Again:")
- cont -= 1
- time.sleep(0.5)
- print(lines[1]+'\n1. 5\n2. 4\n3. 7\nEnter choice number: ')
- q2 = int(input())
- if q2 != 3:
- time.sleep(0.5)
- #print("WRONG!") #Try Again:")
- cont -= 1
- time.sleep(0.5)
- print(lines[2]+'\n1. Russia\n2. China\n3. North America\nEnter choice number: ')
- q3 = int(input())
- if q3 != 1:
- time.sleep(0.5)
- #print("WRONG!") #Try Again:")
- cont -= 1
- time.sleep(0.5)
- print(lines[3]+'\n1. Luxemborg\n2. Vatican City\n3. Monaco\nEnter choice number: ')
- q4 = int(input())
- if q4 != 2:
- time.sleep(0.5)
- #print("WRONG!") #Try Again:")
- cont -= 1
- time.sleep(0.5)
- print(lines[4]+'\n1. 6 Billion\n2. 7 Billion \n3. 5 Billion\nEnter choice number: ')
- q5 = int(input())
- if q5 != 2:
- time.sleep(0.5)
- #print("WRONG!") #Try Again:")
- cont -= 1
- time.sleep(0.5)
- score = (cont/5)*100
- #print("You score out of 5 is ", 5 - cont)
- print("Your score is ", score, '%')
- time.sleep(0.5)
- again = input("Would you like to take another quiz?Y/N\n")
- if again == 'Y' or again == 'y':
- topics()
- else:
- quit()
- def geo_2():
- cont = 5
- print("You have chosen Geograohy Medium! Here you go!")
- g2 = open("geography2.txt",'r')
- lines = g2.readlines()
- time.sleep(0.5)
- print(lines[0]+'\n1. Guyana\n2. Lima\n3. Washington\nEnter choice number: ')
- q1 = int(input())
- #print("q1: :",q1)#mmd
- if q1 != 2:
- time.sleep(0.5)
- #print("WRONG!") #Try Again:")
- cont -= 1
- time.sleep(0.5)
- print(lines[1]+'\n1. Brazil\n2. Northern Ireland\n3. Africa\nEnter choice number: ')
- q2 = int(input())
- if q2 != 1:
- time.sleep(0.5)
- #print("WRONG!") #Try Again:")
- cont -= 1
- time.sleep(0.5)
- print(lines[2]+'\n1. China\n2. Spain\n3. India\nEnter choice number: ')
- q3 = int(input())
- if q3 != 1:
- time.sleep(0.5)
- #print("WRONG!") #Try Again:")
- cont -= 1
- time.sleep(0.5)
- print(lines[3]+'\n1. Atlantis\n2. Earthia\n3. Pangea\nEnter choice number: ')
- q4 = int(input())
- if q4 != 3:
- time.sleep(0.5)
- #print("WRONG!") #Try Again:")
- cont -= 1
- time.sleep(0.5)
- print(lines[4]+'\n1. 45\n2. 29\n3. 20\nEnter choice number: ')
- q5 = int(input())
- if q5 != 2:
- time.sleep(0.5)
- #print("WRONG!") #Try Again:")
- cont -= 1
- time.sleep(0.5)
- score = (cont/5)*100
- #print("You score out of 5 is ", 5 - cont)
- print("Your score is ",score, '%')
- time.sleep(0.5)
- again = input("Would you like to take another quiz?Y/N\n")
- if again == 'Y' or again == 'y':
- topics()
- else:
- quit()
- def geo_3():
- cont = 5
- print("You have chosen Geograohy Hard! Here you go!")
- g3 = open("geography3.txt",'r')
- lines = g3.readlines()
- time.sleep(0.5)
- print(lines[0]+'\n1. Kenya\n2. South Africa\n3. Brazil\nEnter choice number: ')
- q1 = int(input())
- if q1 != 3:
- time.sleep(0.5)
- #print("WRONG!") #Try Again:")
- cont -= 1
- time.sleep(0.5)
- print(lines[1]+'\n1. Chennai\n2. Mumbai\n3. Goa\nEnter choice number: ')
- q2 = int(input())
- if q2 != 1:
- time.sleep(0.5)
- #print("WRONG!") #Try Again:")
- cont -= 1
- time.sleep(0.5)
- print(lines[2]+'\n1. Texas\n2. New York\n3. Alaska\nEnter choice number: ')
- q3 = int(input())
- if q3 != 3:
- time.sleep(0.5)
- #print("WRONG!") #Try Again:")
- cont -= 1
- time.sleep(0.5)
- print(lines[3]+'\n1. Gabriel\n2. Angel Falls\n3. Angel Mountain\nEnter choice number: ')
- q4 = int(input())
- if q4 != 2:
- time.sleep(0.5)
- #print("WRONG!") #Try Again:")
- cont -= 1
- time.sleep(0.5)
- print(lines[4]+'\n1. Japan\n2. Nepal\n3. Thailand\nEnter choice number: ')
- q5 = int(input())
- if q5 != 1:
- time.sleep(0.5)
- #print("WRONG!") #Try Again:")
- cont -= 1
- time.sleep(0.5)
- score = (cont/5)*100
- #print("You score out of 5 is ", 5 - cont)
- print("Your score is ", score , '%')
- time.sleep(0.5)
- again = input("Would you like to take another quiz?Y/N\n")
- if again == 'Y' or again == 'y':
- topics()
- else:
- quit()
- welcome()
- account()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement