Atharva's Trivia Quiz
About Atharva
Atharva Aditya Balvalli, Grade 7 student from Bahrain has created a short 5 questions quiz. After answering all the questions, you will be rated between Outstanding to Needs Improvement.
Atharva's project details:
Welcome to Atharva's Trivia Quiz
Atharva has intelligently used many concepts of Python programming to create this quiz. Read the rules of the quiz and also have a look at his code. Check out the cool coloring effect is given when the answer is right and wrong
Every correct answer will give you 100 points but every wrong answer will deduct 10 points
Let’s start the quiz!
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
OKRED = '\033[91m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
print("\n Welcome to Atharva's Trivia Quiz")
print("\n Your 1st Question is:")
print("Every correct answer will give get 100 points but every wrong answer will deduct 10 points ")
print("\n 1) Who is the Prime Minister of India?\na.Narendra Modi \nb.George Washington \nc.Dr.Rajendra Prasad \nd. Magal Pandey")
ans = (input("Enter your option by typing a,b,c,d: "))
score = 0
if ans=="a" or ans=="A":
# print("Your answer is correct")
print(bcolors.OKGREEN+"Your Answer is Correct"+bcolors.ENDC)
score = score+100
print("Your score = ",score)
else:
# print("Oops your answer is wrong.Better luck next time")
print(bcolors.OKRED+"Oops your answer is wrong.Better luck next time"+bcolors.ENDC)
score = score-10
print("Your score = ",score)
print("\n 2) When was the first Cricket World Cup held?\na.1975 \nb.1983 \nc.1979 \nd.1971")
ans = (input("Enter your option by typing a,b,c,d: "))
if ans=="a" or ans=="A":
#print("Your answer is correct")
print(bcolors.OKGREEN+"Your Answer is Correct"+bcolors.ENDC)
score += 100
print("Your score = ",score)
else:
#print("Oops your answer is wrong")
print(bcolors.OKRED+"Oops your answer is wrong.Better luck next time"+bcolors.ENDC)
score -= 10
print("Your score = ",score)
print("\n 3) What is a small tree with a slender stem?\na.seed \nb.Mango Tree \nc.Sapling \nd.Neem ")
ans = (input("Enter your option by typing a,b,c,d: "))
if ans=="c" or ans=="C":
#print("Your answer is correct")
print(bcolors.OKGREEN+"Your Answer is Correct"+bcolors.ENDC)
score += 100
print("Your score = ",score)
else:
#print("Oops your answer is wrong")
print(bcolors.OKRED+"Oops your answer is wrong.Better luck next time"+bcolors.ENDC)
score -= 10
print("Your score = ",score)
print("\n 4) Who is the best chess player in the world?\na.Vishwanathan Anand \nb.Magnus Carlsen \nc.Fabiano Caruana \nd.Nihal Sarin")
ans = (input("Enter your option by typing a,b,c,d: "))
if ans=="b" or ans=="B":
#print("Your answer is correct")
print(bcolors.OKGREEN+"Your Answer is Correct"+bcolors.ENDC)
score += 100
print("Your score = ",score)
else:
#print("Oops your answer is wrong")
print(bcolors.OKRED+"Oops your answer is wrong.Better luck next time"+bcolors.ENDC)
score -= 10
print("Your score = ",score)
print("\n 5) Which of these is a series of Anime?\na.Pirates Of The Caribbean \nb.Dirlis:Ertugrul \nc.Peaky Builders \nd.Hunter x Hunter")
ans = (input("Enter your option by typing a,b,c,d: "))
if ans=="d" or ans=="D":
#print("Your answer is correct")
print(bcolors.OKGREEN+"Your Answer is Correct"+bcolors.ENDC)
score += 100
print("Your score = ",score)
else:
#print("Oops your answer is wrong")
print(bcolors.OKRED+"Oops your answer is wrong.Better luck next time"+bcolors.ENDC)
score -= 10
print("Your score = ",score)
if score == 500:
#print("Outstanding")
#print(bcolors.OKGREEN+"Outstanding"+bcolors.ENDC)
finalgrade = bcolors.OKGREEN+"Outstanding"+bcolors.ENDC
elif score == 390:
#print("Very Good")
#print(bcolors.OKGREEN+"Very Good"+bcolors.ENDC)
finalgrade = bcolors.OKGREEN+"Very Good"+bcolors.ENDC
elif score >= 260 and score< 390:
#print("Good")
#print(bcolors.OKBLUE+"Good"+bcolors.ENDC)
finalgrade = bcolors.OKGREEN+"Good"+bcolors.ENDC
elif score <= 170:
#print("Need Improvement")
#print(bcolors.OKRED+"Need Improvement"+bcolors.ENDC)
finalgrade = bcolors.OKRED+"Need Improvement"+bcolors.ENDC
print("\n"+ bcolors.UNDERLINE +"Your final rating is:"+bcolors.ENDC)
print('|------------------------------------------|')
print('| |')
print('| |')
print('|'+' '+ finalgrade + ' |' )
print('| |')
print('| |')
print('|------------------------------------------|')
print("\n Thank you for attempting this quiz")