You are on page 1of 70

EDUCATIONAL QUIZ (EduQuizz)

Name—Harsh Patel

Class and Section- 12B

Roll No- 9
INDEX

1) Acknowledgement. Page No-


2) Python overview Page No-
3) About the Project Page No-
4) Functions and Data types used Page No-
5) My contribution Page No-
6) Code Page No
7) Screenshots Page No-
8) Bibliography Page No-

ACKNOWLEDGEMENT
I would like to take the opportunity to express my thanks to our Principal Mr. Tejaskumar
Desai and Computer Science teacher Mr. Alpeshkumar Shah, for guiding and correcting my
various documents with attention and care. He has taken pain to go through the project report
and make corrections whenever required. I would also like to acknowledge my parents and
my team mates whose support me in making this project a successful one.

PYTHON OVERVIEW
Python is a high-level, interpreted, interactive and object-oriented scripting language. Python
is designed to be highly readable. It uses English keywords frequently where as other
languages use punctuation, and it has fewer syntactical constructions than other languages.

 Python is Interpreted − Python is processed at runtime by the interpreter. You do not need
to compile your program before executing it. This is similar to PERL and PHP.
 Python is Interactive − You can actually sit at a Python prompt and interact with the
interpreter directly to write your programs.
 Python is Object-Oriented − Python supports Object-Oriented style or technique of
programming that encapsulates code within objects.
 Python is a Beginner's Language − Python is a great language for the beginner-level
programmers and supports the development of a wide range of applications from simple text
processing to WWW browsers to games.

 Python was developed by Guido van Rossum in the late eighties and early nineties at the
National Research Institute for Mathematics and Computer Science in the Netherlands.

 Easy-to-learn − Python has few keywords, simple structure, and a clearly defined syntax.
This allows the student to pick up the language quickly.
 Easy-to-read − Python code is more clearly defined and visible to the eyes.
 Easy-to-maintain − Python's source code is fairly easy-to-maintain.
 A broad standard library − Python's bulk of the library is very portable and cross-platform
compatible on UNIX, Windows, and Macintosh.
 Interactive Mode − Python has support for an interactive mode which allows interactive
testing and debugging of snippets of code.
 Portable − Python can run on a wide variety of hardware platforms and has the same
interface on all platforms.
 Extendable − You can add low-level modules to the Python interpreter. These modules
enable programmers to add to or customize their tools to be more efficient.
 Databases − Python provides interfaces to all major commercial databases.
 GUI Programming − Python supports GUI applications that can be created and ported to
many system calls, libraries and windows systems, such as Windows MFC, Macintosh, and
the X Window system of Unix.
 Scalable − Python provides a better structure and support for large programs than shell
scripting.

Apart from the above-mentioned features, Python has a big list of good features, few are
listed below −

 It supports functional and structured programming methods as well as OOP.


 It can be used as a scripting language or can be compiled to byte-code for building large
applications.
 It provides very high-level dynamic data types and supports dynamic type checking.
 It supports automatic garbage collection.
 It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java.

ABOUT THE PROJECT

This project is called educational quiz (EduQuizz). In this quiz ,at first the player will have
to select the class in which he studies ( 9 th -10 th ). The player will have to select subject for
which he/she wants to give quiz. There are 2 subjects available for class 9th and 10th for
which the player can give quiz. These are chemistry and physics. The player then has to
answer the questions. There will be 5 levels in the quiz for every subject and the difficulty
level increases with every level. For every correct answer, 100 points will be given and for
every incorrect answer 25 points will be deducted. Also the time taken by the player will be
recorded. At the end of the quiz, a scorecard will be displayed which will contain the total
score of the player, total number of correct and incorrect answers, total time taken by the
player.
The main objective of the quiz is to motivate students towards studies in a fun loving way.
This quiz will help them to understand the importance of time management. Also this will
help them to increase their accuracy and speed of answering questions. Most of the questions
included in this quiz are conceptual based for which a clear understanding of the concept is
required by the students. This will help them to check their grip on concepts and will help to
revise accordingly.

MODULES AND FUNCTIONS USED

TIME MODULE
Python time module allows to work with time in Python. It allows functionality

like getting the current time, pausing the Program from executing, etc. So

before starting with this module we need to import it. 

Functions used in this project:

1) Localtime()-method returns the struct_time object in local time. It takes

the number of seconds passed since epoch as an argument. If the

seconds parameter is not given then the current time returned by

time.time() method is used.


Other functions offered in this module include:

2) time.mktime()- is the inverse function of time.localtime() which converts

the time expressed in seconds since the epoch to a time.struct_time

object in local time.

3) time.gmtime()- is used to convert a time expressed in seconds.

4) time.strftime()- function converts a tuple or struct_time representing a time as returned by


gmtime() or localtime() to a string as specified by the format argument.

5) time.asctime()- method is used to convert a tuple or a time.struct_time object representing a


time as returned by time.gmtime() or time.localtime() method to a string 

FILE HANDLING
Python too supports file handling and allows users to handle files i.e., to read and write
files, along with many other file handling options, to operate on files. The concept of file
handling has stretched over various other languages, but the implementation is either
complicated or lengthy, but like other concepts of Python, this concept here is also easy
and short. Python treats file differently as text or binary and this is important. Each line of
code includes a sequence of characters and they form text file. Each line of a file is
terminated with a special character, called the EOL or End of Line characters like comma
{,} or newline character. It ends the current line and tells the interpreter a new one has
begun.

A text file can be understood as a sequence of characters consisting of alphabets, numbers


and other special symbols. Files with extensions like .txt, .py, .csv, etc. are some examples of
text files.
Binary files are also stored in terms of bytes (0s and 1s), but unlike text files, these bytes do
not represent the ASCII values of characters. Rather, they represent the actual content such
as image, audio, video, compressed versions of other files, executable files, etc.

Functions available in file handling for text file include:


1) read()- This method is used to read all the contents present in the file. It returns string data
type.

2) readline()- It is used to read one line at a time form the file but maximum upto newline
character. It returns a string data type.

3) readlines()- It is used to read all the lines in the file. It returns a list of lines.

4) write()- This method is used to write into text file. It writes one line at a time in the file.

4) writeline()- This method is used to write many lines in the file at same time.

MY CONTRIBUTION TOWARDS THIS PROJECT

In this project I have helped in finding the appropriate questions for


physics (class 9th and 10th) and making the text files which contained the
same. I also helped in writing the code for class 9 th and 10th chemistry
quiz. Also I contributed in making the documentation for this project.
This project could not be completed without the group efforts of our
team.
CODE

import time

print('**************************************************************')

print('***************************EduQuizz***************************')

print('**************************************************************')

print('1,Menu')

print('2,Quit')

print('Please enter the number corresponding to your choice')

a=int(input('Enter your choice: '))

i=0
cor=0

if a==1:

    print('1, 9th std Physics')

    print('2, 9th std Chemistry')

    print('3, 10th std Physics')

    print('4, 10th std Chemistry')

    b=int(input('Enter your choice: '))

    if b==1:

        t1=time.localtime()

        f=open('E:\\q1.txt','r')

        f1=open('E:\\ans1.txt','r')

        c=f.readlines()

        d=f1.readlines()

        print(c[0],

              d[0],

              d[1],

              d[2],

              d[3])

        x=int(input("enter answer"))

        if x==3:

            print("correct")

            i+=100

            cor+=1

        else:
            print("incorrect")

            i-=25

        print(c[1],

              d[5],

              d[6],

              d[7],

              d[8])

        x=int(input("enter answer"))

        if x==1:

           print("correct")

            i+=100

            cor+=1

        else:

            print("incorrect")

            i-=25

        print(c[2],

              d[10],

              d[11],

              d[12],

              d[13])

        x=int(input("enter answer"))

        if x==2:

            print("correct")

            i+=100
            cor+=1

        else:

            print("incorrect")

            i-=25

        print(c[3],

              d[15],

              d[16],

              d[17],

              d[18])

        x=int(input("enter answer"))

        if x==3:

            print("correct")

            i+=100

            cor+=1

        else:

            print("incorrect")

            i-=25

        print(c[4],

              d[20],

              d[21],

              d[22],

              d[23])

        x=int(input("enter answer"))

        if x==4:
            print("correct")

            i+=100

            cor+=1

        else:

            print("incorrect")

            i-=25

        print('           **Level-2**')

        print(c[5],

              d[25],

              d[26],

              d[27],

              d[28])

        x=int(input("enter answer"))

        if x==4:

            print("correct")

            i+=100

            cor+=1

        else:

            print("incorrect")

            i-=25

        print(c[6],

              d[30],

              d[31],

              d[32],
              d[33])

        x=int(input("enter answer"))

        if x==3:

            print("correct")

            i+=100

            cor+=1

        else:

            print("incorrect")

            i-=25

        print(c[7],

              d[35],

              d[36],

              d[37],

              d[38])

        x=int(input("enter answer"))

        if x==1:

            print("correct")

            i+=100

            cor+=1

        else:

            print("incorrect")

            i-=25

        print(c[8],

              d[40],
              d[41],

              d[42],

              d[43])

        x=int(input("enter answer"))

        if x==4:

            print("correct")

            i+=100

            cor+=1

        else:

            print("incorrect")

            i-=25

        print(c[9],

              d[45],

              d[46],

              d[47],

              d[48])

        x=int(input("enter answer"))

        if x==4:

            print("correct")

            i+=100

            cor+=1

        else:

            print("incorrect")

            i-=25
        print('           **Level-3**')

        print(c[10],

              d[50],

              d[51],

              d[52],

              d[53])

        x=int(input("enter answer"))

        if x==2:

            print("correct")

            i+=100

            cor+=1

        else:

            print("incorrect")

            i-=25

        print(c[11],

              d[55],

              d[56],

              d[57],

              d[58])

        x=int(input("enter answer"))

        if x==2:

            print("correct")

            i+=100

            cor+=1
        else:

            print("incorrect")

            i-=25

        print(c[12],

              d[60],

              d[61],

              d[62],

              d[63])

        x=int(input("enter answer"))

        if x==2:

            print("correct")

            i+=100

            cor+=1

        else:

            print("incorrect")

            i-=25

        print(c[13],

              d[65],

              d[66],

              d[67],

              d[68])

        x=int(input("enter answer"))

        if x==3:

            print("correct")
            i+=100

            cor+=1

        else:

            print("incorrect")

            i-=25

        print(c[14],

              d[70],

              d[71],

              d[72],

              d[73])

        x=int(input("enter answer"))

        if x==4:

            print("correct")

            i+=100

            cor+=1

        else:

            print("incorrect")

            i-=25

        print('           **Level-4**')

        print(c[15],

              d[75],

              d[76],

              d[77],

              d[78])
        x=int(input("enter answer"))

        if x==4:

            print("correct")

            i+=100

            cor+=1

        else:

            print("incorrect")

            i-=25

        print(c[16],

              d[80],

              d[81],

              d[82],

              d[83])

        x=int(input("enter answer"))

        if x==1:

            print("correct")

            i+=100

            cor+=1

        else:

            print("incorrect")

            i-=25

        print(c[17],

              d[85],

              d[86],
              d[87],

              d[88])

        x=int(input("enter answer"))

        if x==4:

            print("correct")

            i+=100

            cor+=1

        else:

            print("incorrect")

            i-=25

        print(c[18],

              d[90],

              d[91],

              d[92],

              d[93])

        x=int(input("enter answer"))

        if x==1:

            print("correct")

            i+=100

            cor+=1

        else:

            print("incorrect")

            i-=25

        print(c[19],
              d[95],

              d[96],

              d[97],

              d[98])

        x=int(input("enter answer"))

        if x==1:

            print("correct")

            i+=100

            cor+=1

        else:

            print("incorrect")

            i-=25

        print('           **Level-5**')

        print(c[20],

              d[100],

              d[101],

              d[102],

              d[103])

        x=int(input("enter answer"))

        if x==3:

            print("correct")

            i+=100

            cor+=1

        else:
            print("incorrect")

            i-=25

        print(c[21],

              d[105],

              d[106],

              d[107],

              d[108])

        x=int(input("enter answer"))

        if x==1:

            print("correct")

            i+=100

            cor+=1

        else:

            print("incorrect")

            i-=25

        print(c[22],

              d[110],

              d[111],

              d[112],

              d[113])

        x=int(input("enter answer"))

        if x==3:

            print("correct")

            i+=100
            cor+=1

        else:

            print("incorrect")

            i-=25

        print(c[23],

              d[115],

              d[116],

              d[117],

              d[118])

        x=int(input("enter answer"))

        if x==4:

            print("correct")

            i+=100

            cor+=1

        else:

            print("incorrect")

            i-=25

        print(c[24],

              d[120],

              d[121],

              d[122],

              d[123])

        x=int(input("enter answer"))

        if x==3:
            print("correct")

            i+=100

            cor+=1

        else:

            print("incorrect")

            i-=25

        print("your score is",i)

        t2=time.localtime()

        f.close()

        f1.close()

    elif b==2:

        t1=time.localtime()

        f2=open('E:\\q2.txt','r')

        f3=open('E:\\ans2.txt','r')

        j=f2.readlines()

        v=f3.readlines()

        print('           **Level-1**')

        print(j[0],                             

              v[0],

              v[1],

              v[2],

              v[3])

        w=int(input('enter answer: '))

        if w==4:
            print('correct')

            i+=100

            cor+=1

        else:

            print('incorrect')

            i-=25

        print(j[1],                            

              v[5],

              v[6],

              v[7],

              v[8])

        w=int(input('enter answer: '))

        if w==4:

            print('correct')

            i+=100

            cor+=1

        else:

            print('incorrect')

            i-=25

        print(j[2],                            

              v[10],

              v[11],

              v[12],

              v[13])
        w=int(input('enter answer: '))

        if w==3:

            print('correct')

            i+=100

            cor+=1

        else:

            print('incorrect')

            i-=25

        print(j[3],                          

              v[15],

              v[16],

              v[17],

             v[18])

        w=int(input('enter answer: '))

        if w==1:

            print('correct')

            i+=100

            cor+=1

        else:

            print('incorrect')

            i-=25

        print(j[4],                           

              v[20],

              v[21],
              v[22],

              v[23])

        w=int(input('enter answer: '))

        if w==4:

            print('correct')

            i+=100

            cor+=1

       else:

            print('incorrect')

            i-=25

        print('           **Level-2**')

        print(j[5],                          

              v[25],

              v[26],

              v[27],

              v[28])

        w=int(input('enter answer: '))

        if w==3:

            print('correct')

            i+=100

            cor+=1

        else:

            print('incorrect')

            i-=25
        print(j[6],                           

              v[30],

              v[31],

              v[32],

              v[33])

        w=int(input('enter answer: '))

        if w==4:

            print('correct')

            i+=100

            cor+=1

       else:

            print('incorrect')

            i-=25

        print(j[7],                            

              v[35],

              v[36],

              v[37],

              v[38])

        w=int(input('enter answer: '))

        if w==3:

            print('correct')

            i+=100

            cor+=1

        else:
            print('incorrect')

            i-=25

        print(j[8],                            

              v[40],

              v[41],

              v[42],

              v[43])

        w=int(input('enter answer: '))

        if w==2:

            print('correct')

            i+=100

            cor+=1

        else:

            print('incorrect')

            i-=25

        print(j[9],                             

              v[45],

              v[46],

              v[47],

              v[48])

        w=int(input('enter answer: '))

        if w==3:

            print('correct')

            i+=100
            cor+=1

        else:

            print('incorrect')

            i-=25

        print('           **Level-3**')

        print(j[10],                           

              v[50],

              v[51],

              v[52],

              v[53])

        w=int(input('enter answer: '))

        if w==1:

            print('correct')

            i+=100

            cor+=1

        else:

            print('incorrect')

            i-=25

        print(j[11],                           

              v[55],

              v[56],

              v[57],

              v[58])

        w=int(input('enter answer: '))


        if w==4:

            print('correct')

            i+=100

            cor+=1

        else:

            print('incorrect')

            i-=25

        print(j[12],                           

              v[60],

              v[61],

              v[62],

              v[63])

        w=int(input('enter answer: '))

        if w==4:

            print('correct')

            i+=100

            cor+=1

        else:

            print('incorrect')

            i-=25

        print(j[13],                           

              v[65],

              v[66],

              v[67],
              v[68])

        w=int(input('enter answer: '))

        if w==3:

            print('correct')

            i+=100

            cor+=1

        else:

            print('incorrect')

            i-=25

        print(j[14],                           

              v[70],

              v[71],

              v[72],

              v[73])

        w=int(input('enter answer: '))

        if w==4:

            print('correct')

            i+=100

            cor+=1

        else:

            print('incorrect')

            i-=25

        print('           **Level-4**')

        print(j[15],                           
              v[75],

              v[76],

              v[77],

              v[78])

        w=int(input('enter answer: '))

        if w==1:

            print('correct')

            i+=100

            cor+=1

        else:

            print('incorrect')

            i-=25

        print(j[16],                           

              v[80],

              v[81],

              v[82],

              v[83])

        w=int(input('enter answer: '))

        if w==2:

            print('correct')

            i+=100

            cor+=1

        else:

            print('incorrect')
            i-=25

        print(j[17],                           

              v[85],

              v[86],

              v[87],

              v[88])

        w=int(input('enter answer: '))

        if w==3:

            print('correct')

            i+=100

            cor+=1

        else:

            print('incorrect')

            i-=25

        print(j[18],                           

              v[90],

              v[91],

              v[92],

              v[93])

        w=int(input('enter answer: '))

        if w==2:

            print('correct')

            i+=100

            cor+=1
        else:

            print('incorrect')

            i-=25

        print(j[19],                       

              v[95],

              v[96],

              v[97],

              v[98])

        w=int(input('enter answer: '))

        if w==3:

            print('correct')

            i+=100

            cor+=1

        else:

            print('incorrect')

            i-=25

        print('           **Level-5**')

        print(j[20],                           

              v[100],

              v[101],

              v[102],

              v[103])

        w=int(input('enter answer: '))

        if w==2:
            print('correct')

            i+=100

            cor+=1

        else:

            print('incorrect')

            i-=25

        print(j[21],                           

              v[105],

              v[106],

              v[107],

              v[108])

        w=int(input('enter answer: '))

        if w==4:

            print('correct')

            i+=100

            cor+=1

        else:

            print('incorrect')

            i-=25

        print(j[22],                           

              v[110],

              v[111],

              v[112],

              v[113])
        w=int(input('enter answer: '))

        if w==2:

            print('correct')

            i+=100

            cor+=1

        else:

            print('incorrect')

            i-=25

        print(j[23],                           

              v[115],

              v[116],

              v[117],

              v[118])

        w=int(input('enter answer: '))

        if w==4:

            print('correct')

            i+=100

            cor+=1

        else:

            print('incorrect')

            i-=25

        print(j[24],                           

              v[120],

              v[121],
              v[122],

              v[123])

        w=int(input('enter answer: '))

        if w==3:

            print('correct')

            i+=100

            cor+=1

        else:

            print('incorrect')

            i-=25

        t2=time.localtime()

        f2.close()

        f3.close()

    elif b==3:

        t1=time.localtime()

        print('your time starts now')

        f4=open('E:\\q3.txt','r')

        f5=open('E:\\ans3.txt','r')

        e=f4.readlines()

        f=f5.readlines()

        print('           **Level-1**')

        print(e[0],

              f[0],

              f[1],
              f[2],

              f[3])

        w=int(input('enter answer: '))

        if w==3:

            print('correct')

            i+=100

            cor+=1

        else:

            print('incorrect')

            i-=25

   

        print(e[1],

              f[5],

              f[6],

              f[7],

              f[8])

        w=int(input('enter answer: '))

        if w==1:

            print('correct')

            i+=100

            cor+=1

        else:

            print('incorrect')

            i-=25
        print(e[2],

              f[10],

              f[11],

              f[12],

              f[13])

        w=int(input('enter answer: '))

        if w==2:

            print('correct')

            i+=100

            cor+=1

        else:

            print('incorrect')

            i-=25

           

        print(e[3],

              f[15],

              f[16],

              f[17],

              f[18])

        w=int(input('enter answer: '))

        if w==2:

            print('correct')

            i+=100

            cor+=1
        else:

            print('incorrect')

            i-=25

        print(e[4],

              f[20],

              f[21],

              f[22],

              f[23])

        w=int(input('enter answer: '))

        if w==3:

            print('correct')

            i+=100

            cor+=1

        else:

            print('incorrect')

            i-=25

           

        print('           **Level-2**')

        print(e[5],

              f[25],

              f[26],

              f[27],

              f[28])
        w=int(input('enter answer: '))

        if w==1:

            print('correct')

            i+=100

            cor+=1

        else:

            print('incorrect')

            i-=25

           

        print(e[6],

              f[30],

              f[31],

              f[32],

              f[33])

        w=int(input('enter answer: '))

        if w==4:

            print('correct')

            i+=100

            cor+=1

        else:

            print('incorrect')

            i-=25

           

        print(e[7],
              f[35],

              f[36],

              f[37],

              f[38])

        w=int(input('enter answer: '))

        if w==3:

            print('correct')

            i+=100

            cor+=1

        else:

            print('incorrect')

            i-=25

        print(e[8],

              f[40],

              f[41],

              f[42],

              f[43])

        w=int(input('enter answer: '))

        if w==4:

            print('correct')

            i+=100

            cor+=1

        else:

            print('incorrect')
            i-=25

        print(e[9],

              f[45],

              f[46],

              f[47],

              f[48])

        w=int(input('enter answer: '))

        if w==1:

            print('correct')

            i+=100

            cor+=1

        else:

            print('incorrect')

            i-=25

           

        print('           **Level-3**')

        print(e[10],

              f[50],

              f[51],

              f[52],

              f[53])

        w=int(input('enter answer: '))

        if w==2:

            print('correct')
            i+=100

            cor+=1

        else:

            print('incorrect')

            i-=25

           

        print(e[11],

              f[55],

              f[56],

              f[57],

              f[58])

        w=int(input('enter answer: '))

        if w==3:

            print('correct')

            i+=100

            cor+=1

        else:

            print('incorrect')

            i-=25

           

        print(e[12],

              f[60],

              f[61],

              f[62],
              f[63])

        w=int(input('enter answer: '))

        if w==3:

            print('correct')

            i+=100

            cor+=1

        else:

            print('incorrect')

            i-=25

        print(e[13],

              f[65],

              f[66],

              f[67],

              f[68])

        w=int(input('enter answer: '))

        if w==3:

            print('correct')

            i+=100

            cor+=1

        else:

            print('incorrect')

            i-=25

        print(e[14],

              f[70],
              f[71],

              f[72],

              f[73])

        w=int(input('enter answer: '))

        if w==2:

            print('correct')

            i+=100

            cor+=1

        else:

            print('incorrect')

            i-=25

           

        print('           **Level-4**')

        print(e[15],

              f[75],

              f[76],

              f[77],

              f[78])

        w=int(input('enter answer: '))

        if w==3:

            print('correct')

            i+=100

            cor+=1

        else:
            print('incorrect')

            i-=25

        print(e[16],

              f[80],

              f[81],

              f[82],

              f[83])

        w=int(input('enter answer: '))

        if w==3:

            print('correct')

            i+=100

            cor+=1

        else:

            print('incorrect')

            i-=25

        print(e[17],

              f[85],

              f[86],

              f[87],

              f[88])

        w=int(input('enter answer: '))

        if w==1:

            print('correct')

            i+=100
            cor+=1

        else:

            print('incorrect')

            i-=25

           

        print(e[18],

              f[90],

              f[91],

              f[92],

              f[93])

        w=int(input('enter answer: '))

        if w==2:

            print('correct')

            i+=100

            cor+=1

        else:

            print('incorrect')

            i-=25

           

        print(e[19],

              f[95],

              f[96],

              f[97],

              f[98])
        w=int(input('enter answer: '))

        if w==4:

            print('correct')

            i+=100

            cor+=1

        else:

            print('incorrect')

            i-=25

        print('           **Level-5**')

        print(e[20],

              f[100],

              f[101],

              f[102],

              f[103])

        w=int(input('enter answer: '))

        if w==2:

            print('correct')

            i+=100

            cor+=1

        else:

            print('incorrect')

            i-=25

           

        print(e[21],
              f[105],

              f[106],

              f[107],

              f[108])

        w=int(input('enter answer: '))

        if w==3:

            print('correct')

            i+=100

            cor+=1

        else:

            print('incorrect')

            i-=25

        print(e[22],

              f[110],

              f[111],

              f[112],

              f[113])

        w=int(input('enter answer: '))

        if w==4:

            print('correct')

            i+=100

            cor+=1

        else:

            print('incorrect')
            i-=25

        print(e[23],

              f[115],

              f[116],

              f[117],

              f[118])

        w=int(input('enter answer: '))

        if w==2:

            print('correct')

            i+=100

            cor+=1

        else:

            print('incorrect')

            i-=25

        print(e[24],

              f[120],

              f[121],

              f[122],

              f[123])

        w=int(input('enter answer: '))

        if w==1:

            print('correct')

            i+=100

            cor+=1
        else:

            print('incorrect')

            i-=25

        t2=time.localtime()

        f4.close()

        f5.close()

    elif b==4:

        t1=time.localtime()

        f6=open('E:\\q4.txt','r')

        f7=open('E:\\ans4.txt','r')

        m=f6.readlines()

        n=f7.readlines()

        print('           **Level-1**')

        print(m[0],

              n[0],

              n[1],

              n[2],

              n[3])

        w=int(input('enter answer: '))

        if w==1:

            print('correct')

            i+=100

            cor+=1

        else:
            i-=25

        print(m[1],

              n[5],

              n[6],

              n[7],

              n[8])

        w=int(input('enter answer: '))

        if w==2:

            print('correct')

            i+=100

            cor+=1

        else:

            i-=25

        print(m[2],

              n[10],

              n[11],

              n[12],

              n[13])

        w=int(input('enter answer: '))

        if w==3:

            print('correct')

            i+=100

            cor+=1

        else:
            i-=25

        print(m[3],

              n[15],

              n[16],

              n[17],

              n[18])

        w=int(input('enter answer: '))

        if w==4:

            print('correct')

            i+=100

            cor+=1

        else:

            i-=25

        print(m[4],

              n[20],

              n[21],

              n[22],

              n[23])

        w=int(input('enter answer: '))

        if w==4:

            print('correct')

            i+=100

            cor+=1

        else:
            i-=25

        print('           **Level-2**')

        print(m[5],

              n[25],

              n[26],

              n[27],

              n[28])

        w=int(input('enter answer: '))

        if w==3:

            print('correct')

            i+=100

            cor+=1

        else:

            i-=25

        print(m[6],

              n[30],

              n[31],

              n[32],

              n[33])

        w=int(input('enter answer: '))

        if w==1:

            print('correct')

            i+=100

            cor+=1
        else:

            i-=25

        print(m[7],

              n[35],

              n[36],

              n[37],

              n[38])

        w=int(input('enter answer: '))

        if w==4:

            print('correct')

            i+=100

            cor+=1

        else:

            i-=25

        print(m[8],

              n[40],

              n[41],

              n[42],

              n[43])

        w=int(input('enter answer: '))

        if w==2:

            print('correct')

            i+=100

            cor+=1
        else:

            i-=25

        print(m[9],

              n[45],

              n[46],

              n[47],

              n[48])

        w=int(input('enter answer: '))

        if w==4:

            print('correct')

            i+=100

            cor+=1

        else:

            i-=25

        print('           **Level-3**')

        print(m[10],

              n[50],

              n[51],

              n[52],

              n[53])

        w=int(input('enter answer: '))

        if w==1:

           print('correct')

            i+=100
            cor+=1

        else:

            i-=25

        print(m[11],

              n[55],

              n[56],

              n[57],

              n[58])

        w=int(input('enter answer: '))

        if w==1:

            print('correct')

            i+=100

            cor+=1

        else:

            i-=25

        print(m[12],

              n[60],

              n[61],

              n[62],

              n[63])

        w=int(input('enter answer: '))

        if w==3:

            print('correct')

            i+=100
            cor+=1

        else:

            i-=25

        print(m[13],

              n[65],

              n[66],

              n[67],

              n[68])

        w=int(input('enter answer: '))

        if w==4:

            print('correct')

            i+=100

            cor+=1

        else:

            i-=25

        print(m[14],

              n[70],

              n[71],

              n[72],

              n[73])

        w=int(input('enter answer: '))

        if w==1:

            print('correct')

            i+=100
            cor+=1

        else:

            i-=25

        print('           **Level-4**')

        print(m[15],

              n[75],

              n[76],

              n[77],

              n[78])

        w=int(input('enter answer: '))

        if w==4:

            print('correct')

            i+=100

            cor+=1

        else:

            i-=25

            print(m[16],

              n[80],

              n[81],

              n[82],

              n[83])

        w=int(input('enter answer: '))

        if w==1:

            print('correct')
            i+=100

            cor+=1

        else:

            i-=25

        print(m[17],

              n[85],

              n[86],

              n[87],

              n[88])

        w=int(input('enter answer: '))

        if w==2:

            print('correct')

            i+=100

            cor+=1

        else:

            i-=25

        print(m[18],

              n[90],

              n[91],

              n[92],

              n[93])

        w=int(input('enter answer: '))

        if w==3:

            print('correct')
            i+=100

            cor+=1

        else:

            i-=25

        print(m[19],

              n[95],

              n[96],

              n[97],

              n[98])

        w=int(input('enter answer: '))

        if w==3:

            print('correct')

            i+=100

            cor+=1

        else:

            i-=25

        print('           **Level-5**')

        print(m[20],

              n[100],

              n[101],

              n[102],

              n[103])

        w=int(input('enter answer: '))

        if w==3:
            print('correct')

            i+=100

            cor+=1

        else:

            i-=25

        print(m[21],

              n[105],

              n[106],

              n[107],

              n[108])

        w=int(input('enter answer: '))

        if w==1:

            print('correct')

            i+=100

            cor+=1

        else:

            i-=25

        print(m[22],

              n[110],

              n[111],

              n[112],

              n[113])

        w=int(input('enter answer: '))

        if w==4:
            print('correct')

            i+=100

            cor+=1

        else:

            i-=25

        print(m[23],

              n[115],

              n[116],

              n[117],

              n[118])

        w=int(input('enter answer: '))

        if w==1:

            print('correct')

            i+=100

            cor+=1

        else:

            i-=25

        print(m[24],

              n[120],

              n[121],

              n[122],

              n[123])

        w=int(input('enter answer: '))

        if w==3:
            print('correct')

            i+=100

            cor+=1

        else:

            i-=25

        print("your score is",i)

        t2=time.localtime()

        f6.close()

        f7.close()

    else:

        print('not answerable')

    print('*************************** Scorecard ***************************')

    print('         Total Score: ',i)

    print('         Total correct answers: ',cor)

    print('         Total incorrect answers: ',int(25-cor))

    print('         Accuracy: ',float(cor*100/25),'%')

    print('         The time taken is ',

                   'In hrs: ',abs(t2[3]-t1[3]),

                   'In min: ',abs(t2[4]-t1[4]),

                   'In sec: ',abs(t2[5]-t1[5]))

else:
    print('end')

SCREENSHOTS
Output screen displaying two options: Menu and Quit

When user enters 1, 4 more choices are displayed for classes 9 th and 10 th of subjects
Physics

and Chemistry.
As user enters a choice (here 1), Level 1 starts and at a time a question with 4 options is

displayed. And the user has to enter an option and it will display correct/incorrect. Also, as

the level 1 starts timer starts.

After 5 levels the quiz ends and a scorecard is displayed. The scorecards include total score,
total correct and incorrect answers, accuracy, and total time taken.

BIOBLOGRAPHY
1) www.python.org
2) https://www.geeksforgeeks.org/reading-writing-text-files-python
3) www.vedantu.com
4) https://www.w3schools.com/python
5) https://docs.python.org/3/library/time.html

You might also like