Glossary
- Accumulator
A value that collects a result, such as a total, one step at a time.
First taught in Unit 4
- Argument
A value you give to a function when you call it; the function receives it through a parameter.
First taught in Unit 7
- Arithmetic operators
The symbols
+,-,*,/,//,%, and**(power) calculate with numbers.First taught in Unit 2
- Attribute
A value stored on an object, reached with a name such as
point.x.First taught in Unit 13
- Boolean
One of the two truth values,
TrueorFalse.First taught in Unit 2
- Break and continue
breakleaves a loop;continueskips to its next turn.First taught in Unit 4
- Built-in function
A ready-to-use Python function such as
len(),min(), ormax().First taught in Unit 7
- Class
A set of instructions for making objects with the same kinds of attributes and methods.
First taught in Unit 13
- Code comment
Words after
#that explain code to a reader; Python does not run them.First taught in Unit 1
- Comparison
A test such as
a < bora == bthat givesTrueorFalse.First taught in Unit 2
- Conditional inside a conditional
An
ifblock placed inside another decision to ask a second question only on one path.First taught in Unit 3
- Count by condition
Add one to a count only when an item passes a test.
First taught in Unit 4
- Counter variable
A number you update to track how many loop turns or matching items you have seen.
First taught in Unit 4
- Dictionary
A collection that connects each key to a value, written like
{"red": 3}.First taught in Unit 11
- Dictionary lookup and update
scores["Mia"]gets the value for a key; assigning to that place adds or changes it.First taught in Unit 11
- Else and elif
Extra branches of an
ifdecision:eliftests another condition, andelsecatches the remaining cases.First taught in Unit 3
- Error message
Python's clue about where and why a program stopped.
First taught in Unit 1
- File reading
Getting saved text from a file with
read(),readline(), or a loop over its lines.First taught in Unit 12
- File writing
Saving text with
write()after opening a file in"w"mode.First taught in Unit 12
- Filter into a list
Loop over items and append only the ones that pass a test to a new list.
First taught in Unit 10
- Find the best
Keep the largest or smallest value seen so far, and sometimes the item that owns it.
First taught in Unit 10
- Float
A Python number that can have a decimal part, such as
2.5.First taught in Unit 2
- For loop
A loop that visits each value from a range or collection in turn.
First taught in Unit 5
- Formatted string
Text starting with
fthat puts a value inside braces, as inf"Score: {score}".First taught in Unit 1
- Function definition
A named group of instructions begun with
defand run when you call it.First taught in Unit 7
- If statement
ifruns an indented block only when its condition is true.First taught in Unit 3
- Import
importbrings a module's tools into your program, as inimport turtle.First taught in Unit 6
- Input
input()waits for someone to type a value and gives the program that value as text.First taught in Unit 1
- Integer
A whole number such as
-2,0, or17; Python calls its typeint.First taught in Unit 2
- List
An ordered collection of values written with square brackets, such as
[4, 7].First taught in Unit 10
- List changes
append,insert,pop, andremoveadd or take away list items.First taught in Unit 10
- List indexing
items[0]gets the first item;items.index(value)finds where a value occurs.First taught in Unit 10
- Local scope
A name made inside a function belongs there; a name made outside is available at the program level.
First taught in Unit 7
- Logical operators
and,or, andnotcombine or reverse truth tests.First taught in Unit 3
- Loop over a dictionary
Visit its keys, values, or key/value pairs;
.items()gives each pair.First taught in Unit 11
- Loop over a list
for item in items:visits each list item in order.First taught in Unit 10
- Method
A function belonging to an object, called through that object, such as
counter.increment().First taught in Unit 13
- Name
A clear, meaningful word you choose for a variable or function so its job is easy to see.
First taught in Unit 1
- Nested loops
A loop inside another loop; the inner loop completes its turns for each outer turn.
First taught in Unit 5
- Object creation
__init__runs when you make a new object and usually saves its first attributes throughself.First taught in Unit 13
print()displays a value in the program's output.First taught in Unit 1
- Random choice
random.randint(a, b)chooses an integer fromathroughb;random.choice(items)picks one item.First taught in Unit 8
- Range
range(n)supplies the integers from0up to, but not including,n.First taught in Unit 5
- Return value
A result a function sends back with
return.First taught in Unit 7
- Running a program
Asking Python to follow the instructions in a cell or a
.pyfile.First taught in Unit 1
- Running total
Add each new number to a total as you visit it.
First taught in Unit 4
- Scan until found
Check items one by one and stop as soon as the wanted item appears.
First taught in Unit 9
- Sentinel loop
Keep repeating until a special input says to stop.
First taught in Unit 4
- Sort a list
items.sort()puts the items of that list in order.First taught in Unit 10
- String
Text between quotes, such as
"hello"or'hello'.First taught in Unit 1
- String combining
+joins strings and*repeats a string.First taught in Unit 1
- String index
A position in text;
word[0]gets its first character.First taught in Unit 9
- String methods
Tools called on text, such as
.lower(),.strip(),.split(), and.find().First taught in Unit 9
- String slice
word[start:stop]takes characters fromstartup to, but not including,stop.First taught in Unit 9
- Test with in
"a" in wordasks whether text contains a smaller piece of text.First taught in Unit 9
- Transform each item
Visit every item and make a changed value for each one.
First taught in Unit 9
- Turtle drawing
Pen and color commands change the lines and shapes a turtle makes.
First taught in Unit 6
- Turtle movement
Commands such as
turtle.forward(80)andturtle.left(90)move and turn the drawing turtle.First taught in Unit 6
- Type conversion
int(),float(), andstr()change a value to a needed type.First taught in Unit 2
- Variable
A named place to keep a value, made with an assignment such as
score = 3.First taught in Unit 1
- While loop
A loop that repeats its indented block while a condition is true.
First taught in Unit 4
- With statement
with open(...) as f:gives a block a file and closes it when that block ends.First taught in Unit 12