Answers to the Big Book Quiz - IncrediCoders/Python1 GitHub Wiki

paul_ch1_avatar

Paul Python added this page on July 29, 2025


On page 87 in the book, we test your knowledge with the Big Book Quiz! Here are the answers to those questions!

The Answers

  1. The function setx adjusts the position of the sprite on the x-axis, or the horizontal line of the Turtle Map window. The function sety adjusts the position of the sprite on the y-axis, or the vertical line of the program's window.
  2. In the code, turtle.right(180), the method is right. The turtle module includes this method to turn the turtle. The argument in the parentheses, 180, determines the degree that the turtle turns.
  3. The = operator sets the left variable to the value on the right. This can be a number, string, or another variable. The == symbol is a conditional operator that checks if the left side is equal to the right side. This is often found in a conditional if statement or in a loop. It yields a true or false result. For example, if it isn't true, then the if statement doesn't run.
  4. A while loop runs code continuously until the condition in the while statement is false. You press the Tab key on the keyboard to indent the lines below a while loop. Each line under the while statement is part of the while block. You need to make sure that each line in the while block is indented one place to the right of the while statement in order for it to run as part of the loop.
  5. A list is a structure that stores a collection of values, like numbers, words, or variables. Another name for a list in other programming languages is an array.
  6. The line of code, if event.type == pygame.QUIT, checks to see if the user has closed the window of the program. This is important to include in order to close the program without running any more lines of code.
  7. The line of code, if key_held_down(), checks to see if the key that is inside the parentheses was pressed. An example of an argument that can be added in the parentheses is pygame.K_s. This is a Pygame constant that represents the S key on your keyboard.
  8. The term state represents everything that the computer remembers about the variables and objects in your game, at one point in time. For example, this can represent where the player's character is on the screen, what the character's health bar is showing on the screen, where any items are on the screen, and so on.
  9. An event is when the player interacts with the keyboard or mouse. Typically, an event triggers an action. For example, in SpaceWars, if you press the spacebar, the Player 1 ship fires.
  10. A function is a block of code that you can call from another section of your code. You can pass arguments into your functions. For example, key_held_down(pygame.K_LEFT) is a function that is used to register whether the Left key on the keyboard is held down by the player.
  11. The statement MY.player_health -= 1 subtracts one from the variable MY.player_health and saves the new value back into the variable. This is like saying My.player_health is equal to My.player_health minus one. For example, if a player's character has 5 health points and is then hit by a projectile, then this code is run to remove one health point. The player's character now has 4 health points.
  12. Collision is the process where your game checks whether an object has collided with another object. For example, in the Level 6 Python game, Boss Battle, we check if Paul Python has collided with the walls.
  13. A hitbox is the invisible box-like area in front of characters that shows the range they can attack. For example, in the Level 6 Python game, Boss Battle, the hitbox represents the range in front of Paul Python, where he can hit the Creeper with a melee attack.
  14. The .append() function adds an element (such as a test string) to the end of a list. For example, in the Level 7 Python game, IncrediCards, DECK.append(annie_conda) appended her information to the end of the character list.
  15. A class is like a blueprint for writing code. It's a template that creates new objects, and it groups together related data (attributes) and actions that it can take (methods). It also might include variables. Classes help you organize code so that it's reusable. It's especially useful when you're coding the different parts of a larger program or game. In Level 7, IncrediCards, we define the PlayScreen() class.

Next Steps

We hope you took all that to heart, and you're ready to learn (or to continue learning)! Let's get back to the book! And you should probably also check out the rest of our resources, at IncrediCoders: Python Adventures - All Online Resources.

And you can take a gander at all the rest of our Big Book Buddies, which are pages we have on the Wiki that help out as buddies of the book!

⚠️ **GitHub.com Fallback** ⚠️