Level 3: Bonus Challenges - IncrediCoders/Python1 GitHub Wiki
Annie Conda added this page on March 15, 2023
It's time for some extra challenges. First, you're going to load in a new quiz with more questions! Then, you're going to add in some of your own quiz questions! Finally, you're going to make your own quiz about whatever you want!
To start this bonus challenge, open your completed Level 3 code.
On Line 4, you change 'Assets/Trivia.txt' to 'Assets/Trivia2.txt' (you add the "2" so that it calls the new TXT file with the additional questions).
Line 4 should now look like this:
TRIVIA = read_file('Assets/Trivia2.txt')
The Trivia2.txt file has two new questions about each of the IncrediCoders kids! Instead of 12 questions, you get 36 questions... three about each student!
Make sure you've got the Trivia2 file in your Assets folder. Go one step back from where you found the Trivia1 file. Now you should be in the Assets folder (Python1 -> Level 3 -> Assets). Here you will see the Trivia2 file, which you can click on and download like the other files.
Here is the Level 3 Assets folder on GitHub.
Folder setup:
- First, copy the Assets folder and rename it Assets1. This will save all the original level designs in the Assets1 folder (in case you need to switch back to use those levels).
- In the Assets folder, open Trivia2.txt. (This is if you completed the "Load the Trivia 2 Quiz" bonus challenge. If not, you'll open Trivia.txt) You'll see a file that includes all of the questions and answers that you answered in this level. There should be 36 questions right now in Trivia2.txt, which means it ends on Line 144.
(If you haven't completed the "Load the Trivia 2 Quiz" bonus challenge, you can add questions to Trivia.txt instead. This file has 12 questions and ends on Line 48 (four lines per character, for 12 characters).)
To add questions, scroll to the bottom of the text file (Line 144 in Trivia2.txt). Press Enter to go to the next line. This is where you'll enter your own first question.
- Write the first new question on Line 145.
- Add the correct answer on Line 146
- Add the two wrong answers on Lines 147 and 148.
Repeat this for the next question, for as many questions as you want. Each question should take up four lines: the question, the right answer, and then the two wrong answers (in that order).
Be sure to go back and look at the previous questions for two main reasons:
- So you don't copy questions that have already been written.
- So you have an idea of what information that you are looking for, to write these new questions.
The best place to look for new questions you can ask (about the IncrediCoders students) is by using the Level 2 program, Class Introductions. Download the program, Level 2: Class Introductions. You can also read the students' introductions in your ClassIntroductions.py file, on Lines 19-30.
Folder setup:
- Go to the Assets folder (on your computer, for example).
- You're going to copy the file and paste it in as a new file.
- In Windows, right-click the Trivia.txt file. Select "Copy" (this could be the Copy icon on the top of the menu, of two overlapping rectangles) or "Copy file". Paste the file into your folder, and rename it MyTrivia.txt or another name that you prefer.
- In the GitHub interface, click the Trivia.txt file, and then in the page that shows the content of the file, right-click the "Raw" button, and then click "Save link as". Save the file with a new name, such as MyTrivia.txt.
In your new TXT file (such as MyTrivia.txt), you're going to replace each question with a new question, on any topic you want. (It could be about Pokémon, Harry Potter, Minecraft, Marvel characters, Star Wars, or whatever you want!)
Go ahead and delete all the text in your TXT file. You'll start over in building out your new list of questions and answers...
To create your new trivia questions and answers:
- On Line 1 of the new TXT file, type out your first question.
- On Line 2, type the correct answer.
- On Line 3, type the first incorrect answer.
- On Line 4, type the second incorrect answer.
Repeat these steps for every question you want. Each question gets four lines, with three answers. The code will randomly order your three answers for the player (so that the player doesn't automatically know which answer is correct).
It doesn't matter how many questions you have. The game will end when it runs out of questions!
In order to switch to MyTrivia.txt, go one step back from where you found the Trivia2 file. Now you should be in the Assets section (Python1 -> Level 3 -> Assets). Here you will see the MyTrivia.txt file which you can click on and download like the other files.
Make sure you've got the MyTrivia.txt file in your Assets folder. Go one step back from where you found the Trivia1.txt file. Now you should be in the Assets folder (Python1 -> Level 3 -> Assets). Here you will see the MyTrivia.txt file, which you can click on and download like the other files.
Next, you'll need to update the code to point to your new TXT file, to use your new questions and answers...
In your ClassroomQuiz.py file, you're going to change Line 4 to point to your new trivia TXT file. Change 'Assets/Trivia.txt' (or 'Assets/Trivia2.txt') to the name of your new TXT file (such as MyTrivia.txt
).
Line 4 should now look like this (if you named your file, MyTrivia.txt):
TRIVIA = read_file('Assets/MyTrivia.txt')
Next, you can take on the two extra challenges to add to your Classroom Quiz program and learn more! When you're done, you can move on to Level 4, the Space Wars game!
-
Challenge 1: Add in a score to the game, so you can try to get all the questions right. When the game ends, display the score!
-
Challenge 2: Make the text of the answer choices turn red and green to show which one is the correct answer, as a visual feedback effect.
In addition to this Help page and the instructions for our Level 3 challenges, we also have Online Articles, a Learning Quiz, an Unplugged Activity, and a Rewards article:
-
Level 3: Online Articles - I made you a list of different web pages I found, which will help you learn more about creating a Classroom Quiz.
-
Level 3: Learning Quiz - I wrote some questions in case you want to quiz yourself about what you learned. Or you can teach others and quiz them!
-
Level 3: Unplugged Activity - I wrote this page with more details than what you saw in the book. In this game, you'll have one person act as the developer, and one person act as the variable where the developer chooses a noun for the variable to say in the story that they tell!
-
Level 3: Rewards - If you completed the Class Introductions project that we talked about, then I set up this page to act as a reward. You can see some illustrations of me and learn more about who I am! You'll also find the Apple Award digital download, to show off your accomplishment!
After you're completely done with Level 3 (did you do the challenges?), then it's time to move on to Level 4! While you read through Level 4 in your book, you can check out the resources from SideWinder, as she teaches you how to build the Space Wars game:
I hope you had fun learning about Classroom Quiz! This is something that is very important for all of the future levels! Enjoy!
-- Annie