Kendriya Vidyalaya

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

Kendriya Vidyalaya, BSF, Gandhinagar.

Certificate
This is to certify that Cadet, Srimay Debnath (37) has succesfully completed the project work

entitled “TRIVIA Quiz Game” in the subject computer science (083) laid down in the regulations

of CBSE for the purpose of practical Examinations of class XI to be held in ________________

__________________

PGT Computer Science

__________________

Signature of principal SCHOOL SEAL:


Bibliography
• Computer science with python – Class XI by Sumita Arora

• Website: https://www.w3resource.com

• https://python.mykvs.in

• Google

• Youtube
COMPUTER SCIENCE PROJECT CLASS XI
SYSTEM REQUIREMENTS
Hardware:
Operating system: Windows 7 and above

Processor: INTEL®Celeron CPU 1.90GHz or above

RAM : 8 GB

Hard Disk: 1 TB

SOFTWARE:

Python 64 bits

Windows/Linux Operating system


SOURCE CODE:
def new_game():

guesses = []

correct_guesses = 0

question_num = 1
COMPUTER SCIENCE PROJECT CLASS XI

for key in questions:

print("-------------------------")

print(key)

for i in options[question_num-1]:

print(i)

guess = input("Enter (A, B, C, or D): ")

guess = guess.upper()

guesses.append(guess)

correct_guesses += check_answer(questions.get(key), guess)

question_num += 1

display_score(correct_guesses, guesses)

# -------------------------

def check_answer(answer, guess):


if answer == guess:

print("CORRECT!")

return 1

else:

print("WRONG!")

return 0

# -------------------------

def display_score(correct_guesses, guesses):

print("-------------------------")

print("RESULTS")

print("-------------------------")

print("Answers: ", end="")

for i in questions:

print(questions.get(i), end=" ")

print()

print("Guesses: ", end="")

for i in guesses:

print(i, end=" ")

print()
score = int((correct_guesses/len(questions))*100)

print("Your score is: "+str(score)+"%")

# -------------------------

def play_again():
COMPUTER SCIENCE PROJECT CLASS XI

response = input("Do you want to play again? (yes or no): ")

response = response.upper()

if response == "YES":

return True

else:

return False

# -------------------------

questions = {

"Who created Python?: ": "A",

"What year was Python created?: ": "B",

"Python is tributed to which comedy group?: ": "C",

"Is the Earth round?: ": "A",

"What type of language is Python?": "A",


"Which of the following is/are sequence data types in python?": "D",

"What is an atom in Python?":"A",

"DIctionary in python can be indexed from both forward and backward. Is it True?":"B",

"Who is the owner/CEO of SpaceX?" : "A",

"Which of the Following is a Self-driven Electric Car?": "D",

options = [["A. Guido van Rossum", "B. Elon Musk", "C. Bill Gates", "D. Mark Zuckerburg"],

["A. 1989", "B. 1991", "C. 2000", "D. 2016"],

["A. Lonely Island", "B. Smosh", "C. Monty Python", "D. SNL"],

["A. True","B. False", "C. sometimes", "D. What's Earth?"],

["A. OOP","B. POP","C. Insufficient Data","D. None of these"],

["A. Lists", "B. Tuples", "C. Strings", "D. All of these"],

["A. Something that has a value.","B. Something that cannot be defined","C. Smallest unit
of program","D. None of These"],

["A. Yes","B. No","C. cannot be said", "D. May or may not be Indexed"],

["A. Elon Musk","B. Bill Gates", "C. Warren Buffet","D. Jeff Bezos"],

["A. Toyota Yaris", "B. Alto","C. Mercedes Benz","D. Tesla"]]

new_game()

while play_again():

new_game()

print("BYEEEE!!")

# -------------------------
Acknowledgement
I Would like to express a deep sense of gratitude to our respected Computer Science
Teacher, Mr. Avijit Srivastava, for guiding us through the course of the project.

We would like to express our sincere thanks to Mr. Dibyendu Dutta, Principal, KVS,
Gandhinagar for his constant motivation which helped us in completion of the project
COMPUTER SCIENCE PROJECT CLASS XI

with great ease.

We Extend our Sincere Gratitude to out parents, and our friends for their timely help and
support for completion of the project.
Introduction
This is a simple Quiz Game written in Python Programming language. The concept of the

game is quite simple. The users are asked questions based on current affairs from the

compiler. Options too are being supplied. If the user answer correctly by selecting the

correct option, the compiler displays “Correct” and he wins and the percentage of his

performance is displayed in the output window that appears, otherwise it displays

“Incorrect”. The fact that makes this game so unique is that the user is able to compete

with the computer. Some algorithms are set in python through which it is able to take

decisions and play the game.


COMPUTER SCIENCE PROJECT CLASS XI

Snapshots
CONTENTS
SERIAL NUMBER TOPIC PAGE NUMBER

01. INTRODUCTION 04
COMPUTER SCIENCE PROJECT CLASS XI

02. SYSTEM DESIGN 05

03. SYSTEM REQUIREMENTS 06

04. SOURCE CODE 07

05. SNAPSHOTS 11

06. BIBLIOGRAPHY 13
SYSTEM DESIGN

There are several functions defined in this game which work for different purposes for the
smooth functioning of the game. The system design of this game can be broadly classified into
three categories:

• Game interface and Computer decision algorithm


• Signup/Login System
• User-defined functions, entry and display of game records

The algorithm used in the development of this project is quite simple. The interpreter will ask for
an answer from the user and the latter needs to type the answer via the keyboard of his
computer. I have also utilized the function definitions concepts to call a value contained within
it. The if_else_if ladder(or nested if-else) is used to check whether the given conditions are
satisfied. The questions are however decided by the programmer who writes it. At this stage, it is
not feasible to develop a program which includes random questions asked by the interpreter, as
it requires use of advanced concepts in computer science.

You might also like