Answers to the Big Book Quiz - IncrediCoders/Python1 GitHub Wiki
[Avatar image of Paul Python]
Paul Python added this page on June 9, 2023
On page 87 in the book, we test your knowledge with the Big Book Quiz! Here are the answers to those questions!
The Answers
- The command
setx
adjusts the position of the sprite on the x-axis, or the horizontal line on the program. The commandsety
adjusts the position of the sprite on the y-axis, or the vertical line on the program. - The part of the code,
turtle.right(180)
, that is the method is "right" since it is the built-in method that has code behind it but can be represented by just one code command. - There is no difference in what
==
and=
check for which is if the value to the left of either sign is equal to value of what is on the right side of that sign. - A while loop runs code forever until the condition in the while statement is false. The keyboard key that you press to indent the lines below a while loop is the tab key, and this has to be done for each line until you want to write code that is outside of the while loop.
- A list is a structure that stores a collection of values, like numbers, words, or variables. Another name for a list would be an array.
- The line,
if event.type == pygame.QUIT
, checks to see if the user has closed the window to the program. This is important to include because you do not want to run the rest of the code if there is no one actively playing the game. - The code line,
if key_held_down()
, checks to see if the keyboard key that is represented inside the parentheses was pressed. An example of what could go in the parentheses ispygame.K_s
. - State is everything that the computer remembers about the variables and objects in your game, at one point in time.
- An event is when the player interacts with the keyboard. An example would be pressing the "A" key or the "space bar" on the keyboard and then an action happens as a result of that key being pressed.
- The
update()
function starts and runs the game, handles how the character interacts with the environment, and exits the game if the player chooses to. - The statement
MY.player_health -= 1
subtracts one from the variableMY.player_health
which is one of the Python programs that represented Paul Python’s health. - Collision is the process where your game checks whether an object has collided with another object. For example, in one of the Python programs, we check if Paul Python has collided with the walls.
- A hitbox is the invisible box-like area in front of a character that shows the range they can attack. For example, in one of the Python programs, this represents the range in front of Paul Python, where he can hit the Creeper with a melee attack.
- The
.append()
function adds something to the end of a list, for example in one of the Python programs, DECK.append(annie_conda) appended her information to the end of the character list. - The
start()
method initiates or executes a certain line of code that is in the parentheses. In Level 7, we use thestart()
method to draw all the elements on the screen.
Next Steps
You can also find online versions of the Table of Contents, the Big Book Quiz, and the Nerdy Notes. And we have more resources that are online only:
- What's in the Book - Get an explanation of what's in each chapter (Level) and what you'll learn!
- Glossary + Index - See definitions and explanations of all the terms that are in the Index. And we include the page numbers as well!
- Character Glossary + Index - See information and explanations of all of the characters in the book! And we also include the page numbers where you'll find the characters!
If you have any questions, or if any of the online resources are too confusing (or seem inaccurate), then please let us know by creating a GitHub Issue.