You are on page 1of 36

PROJECT BY:

G.R.TEJNI
K.S.DHARSHANA
R.ARAVIND

Page | 1
INDEX

S.NO TOPIC PAGE NO.

1. Problem Definition 3

2. Problem Analysis 4-5

3. Hardware and Software 6

Requirements

4. Future Enhancements 7

5. Source Code 8-28

6. Output 29-35

7. Bibliography 36

Page | 2
PROBLEM DEFINITION
QUIZ MASTER is based on popular reality quiz shows where a player
has to answer some questions based on various themes. The player gets
to choose the correct answer from four different sets of options. If the
player chooses the right option he gets one point and proceeds. If the
option was wrong no points will be allotted.

Quiz Master consists of 3 Sections:

1.Quiz from pre-existing topics:

This portal allows the user to take a quiz from pre-existing topics
like Computer science, Science, General knowledge and Geography.

2. Friendly Interactive Quiz:

This portal allows the user to enter the questions and the options
corresponding to it. After entering the questions and options the user
can let their friend or their companion take the quiz and receive their
scores accordingly.

3. Expert Mode:

This portal lets the user to play a competitive quiz game mode
where the players competes to get the No.1 spot on the leaderboard.
Unlike others, in this game mode the players get +4 points for
answering a question correctly and -1 point for answering it wrong.

Page | 3
PROBLEM ANALYSIS
LANGUAGES USED:-
Python is an interpreted, object-oriented, high level programming language with
dynamic semantics. Its design philosophy emphasizes code readability with its
use of significant indentation. Its language constructs as well as its object-
oriented approach aim to help programmers write clear, logical code for small
and large-scale projects.
SQL is a domain-specific language used in programming and designed for
managing data held in a relational database management system, or for stream
processing in a relational data stream management system
MySQL Workbench is a visual database design tool that integrates SQL
development, administration, database design, creation and maintenance into a
single integrated development environment for the MySQL database system

MODULES USED:
Random
Sys

FUNCTIONS USED:
Home():
This function is used to display the main portal of the QUIZ MASTER.
Computer():
This function is used to execute the program which is responsible for the
showcasing and interpreting the collected data and thereby letting the player to
take the quiz based on Computer science.
Science():
This function is used to execute the program which is responsible for the
showcasing and interpreting the collected data and thereby letting the player to
take the quiz based on Science.
Page | 4
Geography():
This function is used to execute the program which is responsible for the
showcasing and interpreting the collected data and thereby letting the player to
take the quiz based on General knowledge and Geography.
Question():
This function is the first part of the Interactive friendly quiz portal and it is
used to accept the questions and answers from the users and compile them in a
quiz format and making it available for the user to take the quiz.
Quiz():
This function is the second part of the Interactive Friendly Quiz portal and it
lets the user to take the quiz which was created by their companion. It also allows
the user to save the quiz and play it later.
Expertmode():
This function executes the program to let the user play the Expertmode.
Leaderboard():
This function is used to accept the player details and add them to the current
leaderboard.
ViewLB():
This function lets the user to view the current leaderboard positions of the
top players ranked from the highest score to the lowest score.

Page | 5
HARDWARE & SOFTWARE
REQUIREMENT

The Software Requirements Specification is produced at the culmination of the


analysis task. The function and performance allocated to software as part of
system engineering are refined by establishing a complete information
description, a detailed functional and behavioral description, an indication of
performance requirements and design constraints, appropriate validation criteria,
and other data pertinent to requirements.
IDLE (Python 3.10 64-bit) and MySQL Workbench 8.0 CE were used as
software.
IDLE (Python 3.10 64-bit) is an integrated development environment for
Python, which has been bundled with the default implementation of the language
since 1.5.2b1.MySQL Workbench is a visual database design tool that integrates
SQL development, administration, database design, creation and maintenance
into a single integrated development environment for the MySQL database
system
SOFTWARE SPECIFICATION:-
Operating System : Windows 10
Platform : Python IDLE 3.10 64-bit
Database : MySQL
Languages : Python

HARDWARE SPECIFICATION:-
Processor : Dual core or above
Hard Disk : 40 GB
RAM : 8GB

Page | 6
FUTURE ENHANCEMENT
 The Quiz Master can be given an app like user interface, which can make the
experience even more interactive and fun.

 The ability to add more pre-existing questions to the database giving the user
more options to choose from.

 The ability to create your own marking scheme for the Friendly Interactive
Quiz Portal.

 The ability to create a permanent account which can store your previous
scores along with a login ID and password to access your account.

 Future developments can be done to make this a fully functional public


website, giving access to everyone around the globe to take part in Quiz
master and also turn this into a mobile app can be made for ease of the people
who will get all notifications of upcoming quiz and already existing quiz.

Page | 7
SOURCE CODE
import sys

import mysql.connector

import random

mydb=mysql.connector.connect(host= "localhost" ,user= "root",passwd="asdf",database= "quiz")

mycursor=mydb.cursor()

def Home():

f=1

try:

while f!=4:

print("**************************")

print("Welcome to QuizMaster")

print("**************************")

print("1.Take a Quiz on pre-existing topics")

print("2.Friendly Interactive Quiz")

print("3.Expert Mode")

print("4. Exit")

f=int(input("Enter your choice: "))

if f==1:

while f==1:

print("Select the topic to take on the quiz")

Page | 8
print('1.Computer Science')

print('2.General Knowledge')

print('3.Science')

p=int(input("Type the TOPIC number"))

if p==1:

Computer()

elif p==2:

Geography()

elif p==3:

Science()

else:

print('Type the number corresponding to the TOPIC')

elif f==2:

print('1.Enter the questions')

print('2.Take Quiz')

k=int(input("Enter your choice"))

if k==1:

Question()

elif k==2:

Quiz()

else:

print("Enter the Valid choice")

Home()

elif f==3:

Page | 9
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~")

print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~")

print("Welcome to the Expert mode")

print("********************************")

print("INSTRUCTIONS:- This is a competitive game mode where players compete with their
scores to get the No.1 spot on the Leaderboard.")

print('After the completion of the quiz you will be able to view the leaderboard positions of the top
players along with their dates of participation.')

print("The following table shows the current leaderboard positions of all the previous participants.
Try your best to beat them")

print("***************************************")

ViewLB()

print("***************************************")

print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~")

print('NOTE:- In this Game mode for every correct answer you will recieve 4 points and for every
wrong answer you will lose 1 point. You also have an option to skip the question')

print("Good Luck!!")

print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~")

Expertmode()

print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~")

print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~")

elif f==4:

print("Exiting the Quiz")


Page | 10
mycursor.close()

mydb.close()

sys.exit()

except ValueError:

print('Enter a valid number')

Home()

def Computer():

try:

print("Welcome to Computer Science Quiz portal")

print("***********************")

mycursor.execute("create table csc(qid int(4) primary key,q varchar(500),op1 varchar(100),op2


varchar(100),op3 varchar(100),op4 varchar(100),ans varchar(100))")

mycursor.execute("insert into csc values(1,'Who was the founder of python?','Mark Zukerberg','Just


van Rossum','Bill Gates','Guido van Rossum','Guido van Rossum')")

mycursor.execute("insert into csc values(2,'How is a code block indicated in


Python?','Indentation','Brackets','Key','None of the above','Indentation')")

mycursor.execute("insert into csc values(3,'What is the maximum length of a Python


identifier?','32','64','128','No specified length','No specified length')")

mycursor.execute("insert into csc values(4,'Choose the incorrect option: Python is a/an. .. ','Non-
extensible language','Easy to read language','Free and open source','Interpreted language','Non-extensible
language')")

mycursor.execute("insert into csc values(5,'What data type can hold more than one
value?','String','List','Integer','Boolean','List')")

mycursor.execute("insert into csc values(6,'What would you put in an if statement to see if two values
are equal?','//','++','==','||','==')")

Page | 11
mycursor.execute("insert into csc values(7,'Which of the following is the correct extension of the
Python file?','.p','.py','.python','.pl','.py')")

mycursor.execute("insert into csc values(8,'What arithmetic operators can be used with strings in
Python?','+','-','*','All of the above','+')")

mycursor.execute("insert into csc values(9,'To add a new element to a list we use which Python
command?','list1.addEnd(5)','list1.addLast(5)','list1.append(5)','list1.add(5)','list1.append(5)')")

mycursor.execute("insert into csc values(10,'What is output of print(math.pow(3,


2))?','9.0','9','None','None of the above mentioned','9.0')")

mydb.commit()

mycursor.execute("Select * from csc")

data=mycursor.fetchall()

name=input("Enter your name :")

rc=mycursor.rowcount

noq=int(input("Enter the number of questions to attempt (max %s):"%rc))

if noq>rc:

print("NOTE:- Enter the number of questions less than or equal to",rc)

Home()

l=[]

while len(l)!=noq:

x=random.randint(1,rc)

if l.count(x)>0:

l.remove(x)

else:

l.append(x)

print("Quiz has started")

c=1

score=0
Page | 12
for i in range(0,len(l)):

mycursor.execute("Select * from csc where qid=%s",(l[i],))

ques=mycursor.fetchone()

print(" ")

print("Q.",c,": ",ques[1],"\nA.",ques[2],"\t\tB.",ques[3],"\nC.",ques[4],"\t\tD.",ques[5])

print(" ")

c+=1

ans=None

while ans==None:

choice=input("Answer (A,B,C,D) :")

if choice=='A' or choice=='a':

ans=ques[2]

elif choice=='B' or choice=='b':

ans=ques[3]

elif choice=='C' or choice=='c':

ans=ques[4]

elif choice=='D' or choice=='d':

ans=ques[5]

else:

print("Kindly select A,B,C,D as option only")

if ans==ques[6]:

print("Correct")

score=score+1

else:

print("Incorrect.. Correct answer is :",ques[6])

print(" ")

print("Quiz has ended !! Your final score is :",score)


Page | 13
print(" ")

mycursor.execute("drop table csc")

Home()

except:

print('Refreshing..')

mycursor.execute('drop table csc')

Computer()

def Science():

try:

print("Welcome to Science Quiz portal")

print("***********************")

mycursor.execute("create table sci(qid int(4) primary key,q varchar(500),op1 varchar(100),op2


varchar(100),op3 varchar(100),op4 varchar(100),ans varchar(100))")

mycursor.execute("insert into sci values(1,'What does DNA stand for?','Deoxyribonucleic


acid','Deoxyribonitric acid','Deonucleic acid','Deonitric acid','Deoxyribonucleic acid')")

mycursor.execute("insert into sci values(2,'How many bones are in the human


body?','205','206','207','208','206')")

mycursor.execute("insert into sci values(3,'What is the hardest natural substance on


Earth?','Steel','Platinum','Diamond','Gold','Diamond')")

mycursor.execute("insert into sci values(4,'What is a material that does not carry an electrical charge
called?','Conductor','Insulator','Semi-Conductor','None of the above','Insulator')")

mycursor.execute("insert into sci values(5,'What is the most abundant gas in the Earth
atmosphere?','Nitrogen','Oxygen','Helium','Carbon Dioxide','Nitrogen')")

mycursor.execute("insert into sci values(6,'What name is given for the number of protons found in the
nucleus of an atom?','Mass Number','Atomic Number','Oxidation Number','Neutron Number','Atomic
Number')")

mycursor.execute("insert into sci values(7,'Which of the following is a non metal that remains liquid at
room temperature?','Phosphorous','Bromine','Chlorine','Helium','Bromine')")

Page | 14
mycursor.execute("insert into sci values(8,'Which of the following is used in
pencils?','Graphite','Charcoal','Silicon','Phosphorus','Graphite')")

mycursor.execute("insert into sci values(9,'Which is the most abundant element in the


universe?','Hydrogen','Helium','Nitrogen','Oxygen','Hydrogen')")

mycursor.execute("insert into sci values(10,'Which metal is used in the making of


microchips?','Silicon','Tin','Iron','Copper','Silicon')")

mydb.commit()

mycursor.execute("Select * from sci")

data=mycursor.fetchall()

name=input("Enter your name :")

rc=mycursor.rowcount

noq=int(input("Enter the number of questions to attempt (max %s):"%rc))

if noq>rc:

print("NOTE:- Enter the number of questions less than or equal to",rc)

Home()

l=[]

while len(l)!=noq:

x=random.randint(1,rc)

if l.count(x)>0:

l.remove(x)

else:

l.append(x)

print("Quiz has started")

c=1

score=0

for i in range(0,len(l)):

mycursor.execute("Select * from sci where qid=%s",(l[i],))

ques=mycursor.fetchone()

Page | 15
print(" ")

print("Q.",c,": ",ques[1],"\nA.",ques[2],"\t\tB.",ques[3],"\nC.",ques[4],"\t\tD.",ques[5])

print(" ")

c+=1

ans=None

while ans==None:

choice=input("Answer (A,B,C,D) :")

if choice=='A' or choice=='a':

ans=ques[2]

elif choice=='B' or choice=='b':

ans=ques[3]

elif choice=='C' or choice=='c':

ans=ques[4]

elif choice=='D' or choice=='d':

ans=ques[5]

else:

print("Kindly select A,B,C,D as option only")

if ans==ques[6]:

print("Correct")

score=score+1

else:

print("Incorrect.. Correct answer is :",ques[6])

print(" ")

print("Quiz has ended !! Your final score is :",score)

print(" ")

mycursor.execute("drop table sci")

Home()
Page | 16
except:

print('Refreshing..')

mycursor.execute('drop table sci')

Science()

def Geography():

try:

print("Welcome to General Knowledge Quiz portal")

print("***********************")

mycursor.execute("create table geo(qid int(4) primary key,q varchar(500),op1 varchar(100),op2


varchar(100),op3 varchar(100),op4 varchar(100),ans varchar(100))")

mycursor.execute("insert into geo values(1,'What is the capital of India?','Delhi','New


Delhi','Mumbai','Chennai','New Delhi')")

mycursor.execute("insert into geo values(2,'Which country has the largest population in the
world?','India','China','USA','Russia','China')")

mycursor.execute("insert into geo values(3,'What is the name of the largest country in the
world?','Russia','USA','China','Africa','Russia')")

mycursor.execute("insert into geo values(4,'What is the name of the largest ocean in the world?','The
Pacific Ocean','Indian Ocean','Atlantic Ocean','Arctic Ocean','The Pacific Ocean')")

mycursor.execute("insert into geo values(5,'Which is the longest river in the


world?','Mississippi','Amazon','Ganga','The Nile','The Nile')")

mycursor.execute("insert into geo values(6,'What is the full form of ISRO?','Indian Space Research
Organisation','International Space Research Organisation','Indian Science Research Organisation','Indian
Space Resource Organisation','Indian Space Research Organisation')")

mycursor.execute("insert into geo values(7,'What is the currency of


Japan?','Rial','Yuan','Yen','Dollors','Yen')")

mycursor.execute("insert into geo values(8,'Who is the richest person in India right


now(2022)?','Mukesh Ambani','Gautham Adani','Shiv Nadar','Sundar Pichai','Gautham Adani')")

mycursor.execute("insert into geo values(9,'Who of the following invented Facebook?','Benjamin


Franklin','Bill Gates','Elon Musk','Mark Zuckerberg','Mark Zuckerberg')")

mycursor.execute("insert into geo values(10,'Which one of the following is the second tallest mountain
in the world?','Mt.Everest','K2','Kangchenjunga','Lhotse','K2')")

Page | 17
mydb.commit()

mycursor.execute("Select * from geo")

data=mycursor.fetchall()

name=input("Enter your name :")

rc=mycursor.rowcount

noq=int(input("Enter the number of questions to attempt (max %s):"%rc))

if noq>rc:

print("NOTE:- Enter the number of questions less than or equal to",rc)

Home()

l=[]

while len(l)!=noq:

x=random.randint(1,rc)

if l.count(x)>0:

l.remove(x)

else:

l.append(x)

print("Quiz has started")

c=1

score=0

for i in range(0,len(l)):

mycursor.execute("Select * from geo where qid=%s",(l[i],))

ques=mycursor.fetchone()

print(" ")

print("Q.",c,": ",ques[1],"\nA.",ques[2],"\t\tB.",ques[3],"\nC.",ques[4],"\t\tD.",ques[5])

print(" ")

c+=1

ans=None
Page | 18
while ans==None:

choice=input("Answer (A,B,C,D) :")

if choice=='A' or choice=='a':

ans=ques[2]

elif choice=='B' or choice=='b':

ans=ques[3]

elif choice=='C' or choice=='c':

ans=ques[4]

elif choice=='D' or choice=='d':

ans=ques[5]

else:

print("Kindly select A,B,C,D as option only")

if ans==ques[6]:

print("Correct")

score=score+1

else:

print("Incorrect.. Correct answer is :",ques[6])

print(" ")

print("Quiz has ended !! Your final score is :",score)

print(" ")

mycursor.execute("drop table geo")

Home()

except:

print('Refreshing..')

mycursor.execute('drop table geo')

Geography()

Page | 19
def Question():

try:

mycursor.execute("create table question(qid int(4) primary key,q varchar(500),op1 varchar(100),op2


varchar(100),op3 varchar(100),op4 varchar(100),ans varchar(100))")

ch='Y'

print("***********************")

print("Welcome to Question Portal")

print("***********************")

while ch=='Y' or ch=='y':

q=input("Enter the question :")

op1=input("Enter the option 1 :")

op2=input("Enter the option 2 :")

op3=input("Enter the option 3 :")

op4=input("Enter the option 4 :")

ans=0

while ans==0:

op=int(input("Which option is correct answer (1,2,3,4) :"))

if op==1:

ans=op1

elif op==2:

ans=op2

elif op==3:

ans=op3

elif op==4:

ans=op4

Page | 20
else:

print("Please choose the correct option as answer")

mycursor.execute("Select * from question")

data=mycursor.fetchall()

qid=(mycursor.rowcount)+1

mycursor.execute("Insert into question


values(%s,%s,%s,%s,%s,%s,%s)",(qid,q,op1,op2,op3,op4,ans))

mydb.commit()

ch=input("Question added successfully.. Do you want to add more (Y/N)")

h=input("Do you want to take the Quiz now?(Y/N)")

if h=='y' or h=='Y':

Quiz()

else:

u=input('Do you want to take the Quiz later?(Y/N)')

if u=='y' or u=='Y':

Home()

else:

mycursor.execute('drop table question')

Home()

except:

print("Deleting the previous questions. ..")

mycursor.execute('drop table question')

Question()

def Quiz():

Page | 21
try:

print("**************************")

print("Welcome to Quiz portal")

print("**************************")

mycursor.execute("Select * from question")

data=mycursor.fetchall()

name=input("Enter your name :")

rc=mycursor.rowcount

noq=int(input("Enter the number of questions to attempt (max %s):"%rc))

if noq>rc:

print("NOTE:- Enter the number of questions less than or equal to",rc)

Home()

l=[]

while len(l)!=noq:

x=random.randint(1,rc)

if l.count(x)>0:

l.remove(x)

else:

l.append(x)

print("Quiz has started")

c=1

score=0

for i in range(0,len(l)):

mycursor.execute("Select * from question where qid=%s",(l[i],))

ques=mycursor.fetchone()

print(" ")

print("Q.",c,": ",ques[1],"\nA.",ques[2],"\t\tB.",ques[3],"\nC.",ques[4],"\t\tD.",ques[5])
Page | 22
print(" ")

c+=1

ans=None

while ans==None:

choice=input("Answer (A,B,C,D) :")

if choice=='A' or choice=='a':

ans=ques[2]

elif choice=='B' or choice=='b':

ans=ques[3]

elif choice=='C' or choice=='c':

ans=ques[4]

elif choice=='D' or choice=='d':

ans=ques[5]

else:

print("Kindly select A,B,C,D as option only")

if ans==ques[6]:

print("Correct")

score=score+1

else:

print("Incorrect.. Correct answer is :",ques[6])

print(" ")

print("Quiz has ended !! Your final score is :",score)

print(" ")

input("Press ENTER key to continue")

Home()

except:

print('NOTE:-Enter Questions to continue')


Page | 23
print(" ")

def Expertmode():

try:

print("****************************************")

print("Welcome to Expert Mode Quiz portal")

print("****************************************")

mycursor.execute("create table exp(qid int(4) primary key,q varchar(500),op1 varchar(100),op2


varchar(100),op3 varchar(100),op4 varchar(100),ans varchar(100))")

mycursor.execute("insert into exp values(1,'Which country gifted the STATUE OF LIBERTY to


USA in 1886?','France','England','Russia','Canada','France')")

mycursor.execute("insert into exp values(2,'Total number of Oceans in the world?','3','5','7','9','5')")

mycursor.execute("insert into exp values(3,'Who was the first Indian to go to space?','Vikram


Ambalal','Ravish Malhotra','Rakesh Sharma','Nagapathi Bhat','Rakesh Sharma')")

mycursor.execute("insert into exp values(4,'Who was the first Indian Scientist to win a Nobel
Prize?','C.V Raman','Amartya Sen','Hargobind Khorana','Subramanian Chrandrashekar','C.V Raman')")

mycursor.execute("insert into exp values(5,'Who was the first President of India?','Abdul Kalam','Lal
Bahadur Shastri','Dr. Rajendra Prasad','Zakir Hussain','Dr. Rajendra Prasad')")

mycursor.execute("insert into exp values(6,'What does pip stand for python?','Preferred Installer
Program','Personal Installer Program','Preferred Identifier Program','Personal Identifier Program','Preferred
Installer Program')")

mycursor.execute("insert into exp values(7,' Which of the following is the truncation division
operator in Python?',' / ',' // ',' % ',' || ',' // ')")

mycursor.execute("insert into exp values(8,'Which of the following is not a core data type in Python
programming?','List','Class','Tuple','Dictionary','Class')")

mycursor.execute("insert into exp values(9,'How many Union Territories are there in


India?','4','5','7','8','8')")

Page | 24
mycursor.execute("insert into exp values(10,'1024 Kilobytes is equal
to. ........','1GB','1TB','1MB','None of the above','1MB')")

mydb.commit()

mycursor.execute("Select * from exp")

data=mycursor.fetchall()

name=input("Enter your name :")

print("NOTE:-Make sure to enter the date in the correct format. If the date is not entered properly
your score may not be added to the leaderboard.")

dt=input("Enter Today's date(yyyy-mm-dd)")

rc=mycursor.rowcount

noq=int(input("Enter the number of questions to attempt (max %s):"%rc))

if noq>rc:

print("NOTE:- Enter the number of questions less than or equal to",rc)

Home()

l=[]

while len(l)!=noq:

x=random.randint(1,rc)

if l.count(x)>0:

l.remove(x)

else:

l.append(x)

print("Quiz has started")

c=1

score=0

for i in range(0,len(l)):

mycursor.execute("Select * from exp where qid=%s",(l[i],))


Page | 25
ques=mycursor.fetchone()

print(" ")

print("Q.",c,": ",ques[1],"\nA.",ques[2],"\t\tB.",ques[3],"\nC.",ques[4],"\t\tD.",ques[5])

print(" ")

c+=1

ans=None

while ans==None:

choice=input("Answer (A,B,C,D (or) S(skip)) :")

if choice=='A' or choice=='a':

ans=ques[2]

elif choice=='B' or choice=='b':

ans=ques[3]

elif choice=='C' or choice=='c':

ans=ques[4]

elif choice=='D' or choice=='d':

ans=ques[5]

elif choice=='S' or choice=='s':

ans='skipped'

else:

print("Kindly select A,B,C,D (or) S(skip) as option only")

if ans==ques[6]:

print("Correct")

score=score+4

elif ans=='skipped':

print('Question skipped. ... Correct answer is:',ques[6])

else:

print("Incorrect.. Correct answer is :",ques[6])


Page | 26
score=score-1

m=[]

m.append(name)

m.append(dt)

m.append(score)

Leaderboard(m)

mycursor.execute("drop table exp")

print(" ")

print("Quiz has ended !! Your final score is :",score)

print(" ")

print("Do you want to view the leaderboard?")

G=input("Y/N?")

if G=='y' or G=='Y':

ViewLB()

Home()

else:

Home()

except:

print("Sorry server is Refreshing..Try again")

mycursor.execute("drop table exp")

def Leaderboard(z):
Page | 27
try:

mycursor.execute('create table lbd(name varchar(20),DOP date,score int(3))')

mycursor.execute("insert into lbd values(%s,%s,%s)",(z[0],z[1],z[2]))

except:

mycursor.execute("insert into lbd values(%s,%s,%s)",(z[0],z[1],z[2]))

def ViewLB():

mycursor.execute('select * from lbd order by score desc')

data=mycursor.fetchall()

print("--Name------------Date ------------ Score--")

for row in data:

print(row)

Home()

Page | 28
OUTPUT

Page | 29
This is the output for a user attempting a quiz from one of the
pre-existing topics.

Page | 30
This is the output for the user attempting to take the quiz via
Friendly Interactive Quiz portal.
The user has to enter the questions first in order to take the
quiz.

Page | 31
This the output shown when the user attempts the Friendly
Interactive quiz.

Page | 32
This is the main menu of the Expert mode portal.

This is the output for the user attempting the Expert mode quiz.

Page | 33
Note: In the above shown output we can see as to what happens if we skip a
question.

Page | 34
The above output shows that the user can exit the QuizMaster Portal
anytime they want.

Page | 35
BIBLIOGRAPHY

 https://www.mysql.com
 https://www.python.org
 https://en.wikipedia.org/wiki/SQL
 https://www.gktoday.in/gk-questions/
 Computer Science with Python by Sumita Arora from Dhanpat Rai & Co.
Publication

Page | 36

You might also like