0% found this document useful (0 votes)
8 views3 pages

Fun KBC-Inspired Quiz Game in Python

d
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views3 pages

Fun KBC-Inspired Quiz Game in Python

d
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Introduction:-

Arav: Good Morning everyone.

Arav: My name is Arav.

Zaid: I am Zaid

Devang: And I am Devang.

Arav: With the help of our operator Daksh. We have made the game K.B.C taking the inspiration
from one of India's Famous show Kaun Banega Crorepati. KBC is a game in which you have to answer
the questions, and climb up the prize ladder but wait wait wait there is a twist that you will
win absolutely no money.

Devang: Because we are not sponsored by Adani or Ambani

Arav: So, play for fun, not for funds!"

Zaid: "This code runs the game with questions, options, and lifelines like 50-50 which removes two
incorrect options, Phone-a-Friend which gives you mostly correct answer but can be wrong also like
our decisions sometimes, and Skip which is used to jump to the next question. Answer correctly, and
you’ll hear claps. If you get it wrong, well, the game gently shows you the door—but with style!"

Devang: "Oh, and there’s a robot voice that reads out the questions, like a low-budget Amitabh
Bachchan. It’s here to make sure you feel like you’re in the hot seat."

Arav: "The questions start easy, then get harder. We even added some random fun, like your friend
giving you the wrong answer on the Phone-a-Friend lifeline. Classic, right?"

Zaid: "So, sharpen your brains and get ready to play. Just remember—no crores, only cheers! Enjoy
the game, learn something new, and laugh along the way."

Arav: Now we request our operator to start the game.

(Displaying the program)

(Program ends*)

Body:-

Arav: Let us get to the source code of the program.

Line 1-4:

Arav: These lines import the necessary Python libraries (`tkinter`, `playsound`, `random`, and
`pyttsx3`) for the game's functionality.

Arav: `Tkinter` is used to create the GUI of the game.

Arav: `Playsound` is used to play audio files in the game.

Arav: `Random` is used to randomly select 16 questions.

Arav: `Pyttsx3` is used to convert text into speech, adding a robotic voice to read the questions.
Line:18-22

Devang: The i variable keeps the track of which question is being displayed. The skip used, lifeline 50
used, skip used which keep track if their lifeline is used or not.

Line 215-221:

Devang: This section stores images for highlighted options and prize amounts. These images are
displayed during gameplay to enhance the user experience.

Line 205-208 (select_question function):

Devang: The `select_question` function is a user defined function which generates 16 random indices
from the total list of questions and stores them in the `question_data` variable. This ensures a
unique set of questions each time the game is played.

Line 228-234:

Devang: This block determines which option the user selects.

Line 237-239:

Devang: This section highlights the selected option in yellow, indicating the user’s choice.

Line 240-258:

Devang: If the answer is correct, this section updates the question, options, and prize display for the
next round. If the answer is wrong, the program ends the game and displays the winnings.

ln no.266(Phone-a-Friend):

Arav: The Phone a friend function handles PhoneAFriend lifeline, it gives the player a correct or
wrong option based on chance of 70 ,30 percent respectively by generating a float number between
0-1

ln no.282(skip_question):

Arav: Skip lifeline is used to jump to the next question if there are more level and then updates It’s
image. Again, to prevent using of this

lifeline by the player, skip used variable is set to true.

ln no.301-301 (lifeline_50_50):

Devang: The lifeline_50_50 which handles the 50 50 lifeline in this function

The correct answer is retrieved from the current question then

A list of incorrect options is created by removing the correct option from the list of all options.

Two incorrect options are randomly chosen and removed then lifeline50 used variable is set to true.

ln no.330(giveup function):

Arav: giveup function handles the giveup button which is used to end the game without any fine for
selecting the wrong option above 80k
Line 356 (display_winnings function):

Devang: The `display_winnings` function takes two parameters: the index of the question and a
Boolean indicating if the answer was incorrect. It displays the corresponding prize amount the user
has won.

Line 470-473:

Devang: These lines create the background image for the starting scene, setting up the initial visual
layout of the game.

Line 475-478:

Devang: This section creates the "Play" button, allowing users to start the game.

Conclusion:-

Arav: Coming to the end we hope you all enjoyed the program that was designed to offer a fun and
interactive quiz experience with such an enormous budget.

Zaid: And that's it. No crores, no cash just fun and laughs. Play again for glory, not for money, cause
we are broke too!

Arav: Thanking you. We hope that you all liked our game.

You might also like