Question
Overview: The Trivia Challenge Game tests a players knowledge with a series of multiple-choice questions. The game delivers the questions as a single episode. The
Overview: The Trivia Challenge Game tests a players knowledge with a series of multiple-choice questions. The game delivers the questions as a single episode. The episode created as an example is about The Office and is called, The Office. All of the questions relate in some way to The Office. The cool thing about the game is that the questions for an episode are stored in a separate file, independent of the game code. This way, its easy to play different ones. Even better, this means that anyone with a text editor can create their own trivia episode about whatever topic they chooseanything from anime to zoology.
With the basics of files under your belt, its time to tackle the Trivia Challenge game. As youll see in the code, the text file the program reads, trivia.txt, needs to be in the same directory at the program file. To create your own episode full of questions, all you need to do is replace this file with one containing your own work.
Save as: triviaChallengeGame_yourLastName.py
Understanding the Data File Layout
Before we work on the actually game, you should understand exactly how the trivia.txt file is structured.
The very first line of the file is the title of the episode. The rest of the file consists of blocks of eight lines for each question. You can have as many blocks (and thus questions) as you like. Take a look at the text file I posted as an example.
Here is a generic block:
Take a look at the sample
Remember the first line of the file, The Office, is the episode title for this game. The next eight lines are for the first question. The next eight lines are for the second question. So, the line Who Said It? is the category of the first question. The category is just a clever way to introduce the next question. The next line, Who said is the first question in the game. The next four lines are the four possible answers from which the player will choose. So in this case, the correct answer to the question is the forth answer. The next line, Jim was imitating Dwight, explains why the correct answer is correct. The rest of the questions follow the same pattern.
Follow the pseudocode (below) and complete the program.
Requirements:
- Add you own trivia questions. Minimum of 10. You can choose any topic you like. Must be school appropriate and non-offensive. Hint, your text file should have a total of 81 lines. 1 for the title + 8 for each question * 10 = 81.
- Your python program should run for any number of questions in the text file (not just 10). It should run until there are no more questions to read in.
- Work on the python code FIRST. Use my sample trivia file posted in the mean time. Once that is up and running, then develop your 10 trivia questions.
- You are writing this game (theoretically) for SOMEONE ELSE to play. Therefore, make the interface user-friendly and easy to read.
Sample Pseudocode:
# Trivia Challenge
# triviaChallengeGame.py
# Trivia game that reads a plain text file
# SETTING UP THE GAME
# Open trivia file, get the title of the episode, welcome the player, set score to 0.
# ---insert code below---
# ASKING A QUESTION
# Read the first block of lines for the first question into variables
# Start the main while loop for the game -- will continue to ask questions as long as category
# is not an empty string.
# If category is an empty string the game is over.
# Ask a question by printing the category of the question, the question, and the four possible answers.
# Its important to note that the trivia file does not have numbers next to the possible answer, you
# must figure out how to print them like that in this part of the code.
# ---insert code below---
# GETTING AN ANSWER
# Get the players answer
# ---insert code below---
# CHECKING THE ANSWER
# Compare user answer to correct answer.
# If they match, the player is congratulated and his/her score is increased by one.
# If they don't match, the player is told he/she is wrong.
# In either case, display the explanation.
# Lastly display the players current score.
# ---insert code below---
# GETTING THE NEXT QUESTION
# Get the next block of strings for the next question.
# ---insert code below---
#ENDING THE GAME
#After the loop, close the trivia file and display the player's final score
#---insert code below---
The text file:
Welcome to the BTS Trivia challenge!
Debut
With which of these songs did BTS debut?
No More Dream
Dynamite
Yet to Come
Fire
No More Dream
This is the first song BTS came out with
Production
Does BTS produce their own music?
No
Yes
Maybe
No idea
Yes
All BTS members have produced music before
Nickname
RM stands for:
Rap Monster
Rick & Morty
Role Model
Rift Off
Rap Monster
Rap Monster was inspired by San E's "Rap Genius"
V
Which hand does V uses for writing?
Left
Right
Both (ambidextrous)
None
Both (ambidextrous)
V was born left-handed, but he trained his right hand so that he is equally dominant in both hands
Delivery
_____used to be a delivery boy
Jhope
Jungkook
RM
Suga
Suga
Before joining BTS, Suga worked as a delivery driver
Food
Who is least likely to like spicy food?
Jimin
Suga
Jungkook
J-Hope
Jimin
Jimin said spicy food is too hard to eat
BTS
What does BTS stand for?
Be The Best
Bangtan sonyeondan
Boloron sondega
Bangtan boys
Bangtan sonyeondan
Bangtan sonyeondan translates to Bulletproof Boy Scouts
Piercings
Which band member of BTS ears are not
pierced?
RM
Jin
J Hope
Suga
J Hope
J-Hope is the only member of BTS with no piercings (that we know of), and he seemingly has no plans to get any.
ARMY
ARMY stands for :
Adorable Representative M.C. for Youngsters
Adelaide Representative M.C. for Youth
Adorable Representative M.C. for Youth
Adorable Representative M.C. for You All
Adorable Representative M.C. for Youth
This acronym was created by BTS themselvesFinal Lineup
BTS wasnt even finalized till:
2010
2011
2012
2013
2012
The seven-member band was formed through auditions by Bit Hit Entertainment in 2010 and 2011, and finalized in 2012.
Output:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started