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, True or False.

First taught in Unit 2

Break and continue

break leaves a loop; continue skips to its next turn.

First taught in Unit 4

Built-in function

A ready-to-use Python function such as len(), min(), or max().

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 < b or a == b that gives True or False.

First taught in Unit 2

Conditional inside a conditional

An if block 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 if decision: elif tests another condition, and else catches 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 f that puts a value inside braces, as in f"Score: {score}".

First taught in Unit 1

Function definition

A named group of instructions begun with def and run when you call it.

First taught in Unit 7

If statement

if runs an indented block only when its condition is true.

First taught in Unit 3

Import

import brings a module's tools into your program, as in import 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, or 17; Python calls its type int.

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, and remove add 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, and not combine 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 through self.

First taught in Unit 13

Print

print() displays a value in the program's output.

First taught in Unit 1

Random choice

random.randint(a, b) chooses an integer from a through b; random.choice(items) picks one item.

First taught in Unit 8

Range

range(n) supplies the integers from 0 up 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 .py file.

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 from start up to, but not including, stop.

First taught in Unit 9

Test with in

"a" in word asks 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) and turtle.left(90) move and turn the drawing turtle.

First taught in Unit 6

Type conversion

int(), float(), and str() 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