Glossary & Index - IncrediCoders/Python1 GitHub Wiki

paul_ch1_avatar

Paul Python added this page on July 29, 2025


At the back of IncrediCoders, you’ll find a helpful Index to more easily find the coding terms in the book. This online version includes a Glossary along with the Index! The glossary defines key coding terms and concepts used throughout the book, while the index helps you quickly find where each topic appears. You can click a letter to jump down to that section of this glossary:

   A | B | C | D | E | F | H | I | K | L | M | P | R | S | T | U | V | W | X | Y

A

add_rotation() function, 43-44

The add_rotation function allows us to rotate our ships in Level 4: SpaceWars, depending on which key we press. This function is located in the init.py file within Level 4.

add_velocity() function, 43, 45

The add_velocity function allows us to move forward or slow down with our ships depending on which key we press. This function is located in the init.py file within Level 4.

ANSWER_CHOICES[] list, 29, 31-34

The ANSWER_CHOICES list stores all our possible answers in a Python list. This list then is randomized and displayed to the user in Level 3, Classroom Quiz.

Argument, 32-33, 52-53, 56, 68, 76-77

An argument is the actual value or data passed into your Python function.

Array, 28, 77

An array is a list of values. There is no built in array data type in Python, so we use lists instead.

B

BossBattle.py file, 65

The BossBattle.py file is the Python template you use to create the Level 6 Incredicoders game, Boss Battle.

C

Card() function, 76-77

The Card() function is a constructor used for creating Incredicards in Level 7. The arguments passed into this constructor allow us to determine the name and types of attributes of the card.

change() function, 57

The change() function is used in Level 5 to change the state of the game. States are used to describe where the progression of our games are. On page 57, we use change() to show that Paul has won the game by showing the win screen.

check_events() function, 69

The check_events() function checks to see if the Creeper is attacking Paul in Level 6. Any other subsequent actions from the player like clicking is also checked while this function is called.

check_win() function, 45, 69

The check_win() function checks to see if the player has won the game.

Class, 19, 78-79, 83

A class is a reusable blueprint or template used to create instances of the class known as objects. Classes allow us to reduce code redundancy in our programs.

ClassIntroductions.py file, 17, 21

The ClassIntroductions.py file is the main template file you use for Level 2.

ClassroomQuiz.py file, 28, 30, 35

The ClassroomQuiz.py file is the main template file that you use for Level 3.

collidepoint() function, 31-33

The collidepoint() function checks whether or not the user's mouse click was in the boundary of the answer boxes in Level 3. It is a built in function provided to use from the Pygame library.

Collision, 55, 64-65

Collisions are a way to check whether an object in the game has collided with another object. For Level 6, we check if Paul has collided with the walls or the Creeper.

Comment, 9, 21, 31, 43, 65, 77

Comments are a way of writing descriptions of code to help the user understand what is happening in the code. A good program has lots of comments to help the reader understand what the writer of the code is thinking.

current_character variable, 18, 20-22

The current_character variable of Level 2 displays a character from a list on the main screen.

current_text variable, 18, 20-22

The current_text variable of Level 2 displays the text from the list on the main screen.

D

DECK[] list, 77

The DECK[] list holds cards in a list data structure from Level 7. Incredicards can be added to this list to build a deck for each player in Level 7.

delta_time argument, 41, 44, 52, 56-57, 64, 69

The delta_time argument is the amount of time that passes between two consecutive frames in our game. We use delta time to achieve framerate independence, which allows the objects to move at the exact same physical speed regardless of frames per second.

Dictionary, 83

A Dictionary is a data structure that is a collection of key value pairs. For every lookup key, there is a value (or definition) of that key. An English dictionary allows up to look up the definition of a word. The word is the key and the definition is the value.

display_codala() function, 31-34

The `display_codala() function allows us to put Mrs. Codala up on the screen of our Level 3 Classmate Quiz level.

display_question() function, 30

The display_question() function allows us to display our current question on the screen of our Level 3 Classmate Quiz level.

E

elif keyword, 41-45, 53-55, 67-68

The elif keyword is a type of if conditional statement that checks the rest of the if statements in a block of code. When an elif statement isi true, the block of code in the elif will run and the rest of elif statements will be skipped.

Elif statement, 41-42, 53-54, 67

This keyword comes from the combination of two other keywords: else and if. elif is used when you have more than one condition to check at the same time. You would start with an if statement, and then in every subsequent block that is similar to an if condition, you would instead write elif. At the end of these conditions, you would still put an else statement for the very last code block.

else keyword, 31-34, 54, 56, 81-82

The else keyword is part of the if conditional statement that executes as a catch all for any condition that isn't listed in the if statements above it.

Else statement, 31-34 The else: statement provides an alternative if the if statement isn't true. For an else statement to run, it must be indented at the same level as the if statement above it. If the else statement is not indented at that level, then your code will not run properly. The code won't throw any errors about the improper indentation, so if your program isn't running like it should, you should check to make sure the else statement is indented at the correct level.

Event, 20-21, 30-31, 41

An Event is an action done by the player in our game. These can be mouse clicks or button presses.

event.get() function, 20, 30, 41

The event.get() function is a function from the pygame library. We use this function to retrieve any actions performed by the player. This function also clears the queue of events performed by the player. For example, if the player presses the W key and then immediately presses the S key, the event.get() function capture both key presses. If the event.get() function were called in between the W key press and the S key press, only the W key press would be captured with the S key press still left in queue.

event.key method, 21

The event.key method returns a keyboard key that allows us to assess what key has been pressed by the player so that we can tie that key to an action in the game. In this case we use it to see if the player has pressed a button to scroll through an introduction from the class.

event.type method, 20, 31, 41

The event.type method returns a type of event that allows us to categorize what the player has pressed. If our player presses the x in the top corner, the game ends and closes.

F

False keyword, 20, 30-31, 57, 66, 69, 81-82

fire_bullet() function, 41-42 This function runs the code that fires a bullet for a ship. The number argument (in the parentheses) represents which player you want to fire a bullet, 1 for Player 1 or 2 for Player 2.

For loop, 20, 31, 41, 55

A for loop is a group of code that will repeat as many times as possible as long as the condition is true. For example, let's say your condition is that the loop will run until your variable equals 10. If your variable is initially set to equal zero, and you add one to your variable each time the loop runs, then your loop runs 10 times. This saves you from writing those lines of code more than one time.

from keyword, 7, 41

The 'from' keyword allows us to import libraries so we can use the functions and objects from that library.

Function, 19, 30, 32-34, 52-53, 55-56, 65-66, 69

This is a block of code that does something. A function usually performs one or more specific action(s), for example if a variable's value is equal to 1, then a function for displaying its value would display the number 1. One example is the display() function.

H

Hashtag, 9, 21, 32, 43, 65, 77

Hashtags (the # symbol) before a line of code will turn that line into a comment. A comment will not run when the program is executed. You can comment out some lines of code to test individual pieces of the program to see if they work, and then you can find where your problems are. For example, this comment in our TurtleMap.py file, won't run (it just tells us what the next new lines of code do):

    #Creates our screen

Hitbox, 66-69

A Hitbox is an invisible area of our character that represents where they can be attacked or damaged.

I

If, 20-22, 31-34, 41-44, 54-56, 64-66, 69, 80-82

The if statement contains the block of statements that will be executed under the if expression, when the expression is true.

If ladder, 21-22, 24, 31

This is a sequence ofif statements. Each statement has a condition, and if the condition evaluates to true, the part of the code that is indented under that if condition runs. For example, if event.key == pygame.K_3: is an if condition or if statement. When you write some of these if statements sequentially in your code, we call it an if Ladder.

import keyword, 6-7, 41

Importing means to load libraries (which are toolboxes full of tools) into a program. For example, we import the turtle module to load and access the turtle methods (commands and properties). After you import the turtle module, you can set the shape and color of the turtle.

Incredicards.py file, 76

The Incredicars.py file is Level 7 of our Incredicoders game.

Index, 29, 33

An Index in Python is a representation of a position. When we access a list, the index will be the number designating the position of the element in a list.

init.py, 7, 19, 28, 40-41, 52, 57, 64-65, 76-77, 80

We have an init.py file for every level. We put extra code in this file that you don't need to write yourself. For Level 1, the code in the init.py file grabs the files from your folder (so your Turtle Map program can use it), like the Background.gif file.

Initialization, 19, 40

Initialization is the process where you set the value of a variable to something that starts the operation, in case we're constructing the loop. For example, in a loop we use a variable to track which pass of the loop we're on (such as the third time through).

K

key_down() function, 41-42

This function tells us whether a key is pressed. The key can be a letter key, number key, or special character key. (Since we only care about when the keys are first pressed down, we don't need a "key up" function.)

key_held_down() function, 43-45, 52-53 This function tells us whether a key is being held down. Just like key_down(), the key can be a letter key, number key, or special character key, but the difference is we are checking if the key is being pressed down for a longer period of time.

L

List, 28-30, 33, 77

This is a Python data structure that stores a collection of values, like numbers, words or variables. For example, the TRIVIA list stores text (strings).

load_file() function, 19

If you look at the init.py file, in Line 10 you can see the code, def load_file(fileName): This is a definition of a function called load_file(). In the template file, you are calling this function on Lines 4 to 16. For example, on Line 4, in our ClassIntroductions.py file, it says background = load_file("Assets/Background.png"). You call the load_file() function and pass the string "Assets/Background.png" to this function. This stores the function's output in the background variable.

M

Method, 9, 19, 30, 66-67, 77-83

Methods are built-in code so you do not have to write all the code out yourself. For example, right() in turtle.right() is a method that tells the turtle to go right. You do not have to write out all the code that makes the turtle go right, because it is already built in the right() method.

min() function, 53-54

The min() function takes the arguments and returns the lowest value.

Module, 9, 19

A module in Python is a library, which includes an object and methods. It's a set of useful statements, just like how a toolbox is full of useful tools. A library has a specific purpose, like complex math functions, or allowing you to control a turtle. For example, we use the screen and turtle objects in Level 1.

MY.player_collides_with() function, 55

This function checks to see if the player has had a collision with the object(argument). This function returns a boolean(true/false).

MY.player_hitbox.location method, 67

This function sets the player's hitbox location with a Vector2 object.

P

Parameter, 53, 57, 76, 78, 82

A parameter in python is the variable listed inside the parentheses of a function's definition. This term is commonly confused with argument. Remember, the parameter is a term for when you define the function and the argument is the term for when you are calling the function.

PLAYER_ACCEL variable, 53

The PLAYER_ACCEL variable is a set number that defines how much the player can accelerate when calculating the velocity.

player_attack_update() function, 69

This function makes the hitbox active and starts Paul's attack animation.

PLAYER_DECEL variable, 54

The PLAYER_DECEL variable is a set number that defines how much the player will decelerate when calculating the velocity.

player_pain_anim() function, 66

This function will display Paul getting hit by the creeper on Level 6.

pygame module, 19-21, 23, 31, 41-45, 52-53, 66

The pygame module is the library where we borrow the basic framework for building Incredicoders games. This library has functions and objects that are useful for creating objects and functions.

pygame.KEYDOWN method, 20

The pygame.KEYDOWN method checks to see if the player has pressed a key.

pygame.math.Vector2() function, 66-68

The pygame.math.Vector2() is a Pygame class the represents a 2-dimensional vector that holds x and y coordinates.

pygame.QUIT method, 20

quit() is a pre defined function in the pygame package. When you say quit() it means that you are calling quit function. This piece of code, pygame.quit(), closes the program and you will quit the game by running this line of code.

Python programming, 6, 17-18, 24, 28-29, 78

There are many coding languages. The one you are using, Python, has its own unique set of rules and functions, in order for you to be able to run your code. We believe Python is a great first language to use, as it is a full, professional language that is easy to learn (due to its syntax and readability). It's simpler than most programming languages.

R

random module, 77

The random module allows us to use objects and functions to generate random numbers.

restart_level() function, 56

The restart_level() function restarts Paul to the beginning of the current level.

S

ship_rotate variable, 43-44

This is a number variable that represents the rate at which the ship should rotate (how fast it turns).

SpaceWars.py file, 40-41, 45

This is the template file for Level 4.

start() method, 79

The start() method creates the players and sets who is attacking and who is defending.

State, 45, 57, 78, 83 Everything that the computer knows about the variables and objects in your game, at a specific point in time.

stop() function, 41, 52

This function ends the game.

Syntax, 7

Syntax is the correct way to write code--just like proper spelling and grammar is the correct way to write English. If your syntax is correct, the code you write will be read by the computer, and your instructions will be executed (your code runs like expected). However, if the syntax does not match exactly as the Python language expects it, then the program may not execute your code in the way that you wanted. You might get errors that you've got to fix.

T

TRIVIA[] list, 28-30

This is the list we create for storing the questions and answers from the Trivia.txt file, line by line.

Trivia.txt file, 28, 30, 34-35

This is the file that contains multiple sets of questions and their three answer choices. Every four lines contain a question, its correct answer, and two wrong answers.

True keyword, 30, 79-82

The True keyword in Python is a boolean. It is usually used in conjunction with a conditional statement to determine whether we should execute the block of code in the statement.

turtle module, 6-9

The turtle module is a set of methods (or commands) that tell the turtle what to do. They describe what the turtle is going to look like (the properties). For example, you can tell the turtle to move or rotate. These are commands. You can also change the color of the turtle (using turtle.color()) or the shape of the turtle (using turtle.shape()). These are properties. In this program, our turtle is green and is shaped like a turtle (rather than an arrow, which is the default shape). These are properties that we set. Together, commands and properties are called methods.

turtle.color() function, 7

This method changes the color of your turtle character to any color that you put in the parentheses. It will turn the turtle character to that color. Be sure to use quotes. For example, you use the code turtle.color("green") to change the turtle's color to green.

turtle.Screen() function, 6

The turtle.Screen() function creates the background display of Level 1.

turtle.setx() function, 8

The location of the turtle on the x-axis.

turtle.sety() function, 8

The location of the turtle on the y-axis.

turtle.shape() function, 7

This method changes the shape of your turtle character that you put in turtle.shape("turtle"). The default shape is actually an arrow. (The old Logo programming language originally made the turtle an arrow shape.) You can change the turtle shape to be any one of these (you put it in quotes in the parentheses, and replace "turtle"): "arrow", "turtle" (the shape that we use), "circle", "square", "triangle", and "classic".

TurtleMap.py file, 7

This file loads the map that shows you Grafika's house and IncrediCoders Academy. There are a few paths you can take, to get to the school. You'll use a different path to get to the school in Level 1, Challenge 1. In Level 1, Challenge 2, you'll go back and forth (five times) on this map, between the house and school.

U

update() function, 41, 52, 64, 80

This function contains the code we want to run every time the game needs to be updated. It's where all the fun game logic happens! The function takes the parameter, delta_time, which represents the change in time since the last update. This helps us keep the animations in their proper places and helps keep the framerate running smoothly. The delta_time variable is our standard for how fast we want our framerate to be, in relation to our time.

V

Value, 28-29

The value is the element that we access in a list. For Level 3, the value is a text string in our TRIVIA list.

Variable, 17-22, 28-31, 34, 53-56, 66, 68, 76-77

A variable is a storage location (kind of like a drawer) that's given a specific name (such as SCREEN, in this example). A variable contains a known or unknown quantity of information, which is referred to as a value. For example, it could be a number or a string, which is a bunch of text in quotes (like, "Grafika is great at explaining things"). Or it could be other code, like another variable or a function (which is how we're using it).

W

while keyword, 20, 30

You can use a while statement to create a loop. The while loop statement has two parts. The first part is the word while, and the second part is a condition. The section of code that is inside the while loop runs repeatedly, as long as this condition is true. In order to exit the loop, you need to make this condition false. For example, in the game, the while running: statement repeats the code inside of it, as long as running is true. When you set running = false (like if you close the program window), then you make the condition false, and you break the loop. (Python leaves the loop and goes on to execute any other lines in the code file.)

While loop, 20, 30, 41

You can use a while statement to create a loop. The while loop statement has two parts. The first part is the word while, and the second part is a condition. The section of code that is inside the while loop runs repeatedly, as long as this condition is true. In order to exit the loop, you need to make this condition false. For example, in the game, the while running: statement repeats the code inside of it, as long as running is true. When you set running = false (like if you close the program window), then you make the condition false, and you break the loop. (Python leaves the loop and goes on to execute any other lines in the code file.)

while running: statement, 30

The while running: statement is a conditional statement that checks to see whether or not the game should continue or if it should end. If running is false, then the game ends.

X

X axis, 8

The X and Y axes are the directions that you can move the turtle. Y coordinates move up (a positive Y coordinate number) and down (a negative number). Likewise, X coordinates move left (a negative X coordinate number) and to the right (a positive number).

Y

Y axis, 8

The X and Y axes are the directions that you can move the turtle. Y coordinates move up (a positive Y coordinate number) and down (a negative number). Likewise, X coordinates move left (a negative X coordinate number) and to the right (a positive number).

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! Be sure to check out the Character Glossary & Index, which is the exact same as this page, but completely different! (We give brief bios of the characters of the book and the pages where you'll find them!

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