Working in Python · Book Vocabulary ↪ AP CSP Vocabulary Coverage ↪ A-Z Glossary (merged)

Vocabulary by Chapter

Every term from Downey's own chapter-ending Glossary sections, chapters 1–18, plus any interludes' own glossaries, in reading order. This is the book's own vocabulary, exactly as written — not a paraphrase, not a standards crosswalk.

222
glossary terms, chapters 1–18 + 2 interludes
18
chapters with a Glossary section (plus 2 interludes)
59
on the AP CSP exam's own vocabulary list

AP on the AP CSP exam's vocabulary list (Also ch. N.) also defined in another chapter — link jumps there

Studying for the exam?

Chapter 1 — Welcome

17 terms
TermDefinition
arithmetic operatorA symbol, like + and *, that denotes an arithmetic operation like addition or multiplication.
integerAPA type that represents numbers with no fractional or decimal part.
floating-pointA type that represents integers and numbers with decimal parts.
integer divisionAn operator, //, that divides two numbers and rounds down to an integer.
expressionAPA combination of variables, values, and operators.
valueAn integer, floating-point number, or string — or one of other kinds of values we will see later. (Also ch. 10.)
functionAPA named sequence of statements that performs some useful operation. Functions may or may not take arguments and may or may not produce a result.
function callAn expression — or part of an expression — that runs a function. It consists of the function name followed by an argument list in parentheses.
syntax errorAPAn error in a program that makes it impossible to parse — and therefore impossible to run.
stringAPA type that represents sequences of characters.
concatenationAPJoining two strings end-to-end.
typeAPA category of values. The types we have seen so far are integers (type int), floating-point numbers (type float), and strings (type str).
operandOne of the values on which an operator operates.
natural languageAny of the languages that people speak that evolved naturally.
formal languageAny of the languages that people have designed for specific purposes, such as representing mathematical ideas or computer programs. All programming languages are formal languages.
bugAn error in a program.
debuggingAPThe process of finding and correcting errors.

Chapter 2 — Variables and Statements

15 terms
TermDefinition
variableAPA name that refers to a value.
assignment statementAPA statement that assigns a value to a variable.
state diagramA graphical representation of a set of variables and the values they refer to.
keywordA special word used to specify the structure of a program.
import statementA statement that reads a module file so we can use the variables and functions it contains.
moduleAPA file that contains Python code, including function definitions and sometimes other statements.
dot operatorThe operator, ., used to access a function in another module by specifying the module name followed by a dot and the function name.
evaluatePerform the operations in an expression in order to compute a value.
statementOne or more lines of code that represent a command or action.
executeRun a statement and do what it says.
argumentAPA value provided to a function when the function is called.
commentAPText included in a program that provides information about the program but has no effect on its execution.
runtime errorAPAn error that causes a program to display an error message and exit.
exceptionAn error that is detected while the program is running.
semantic errorAPAn error that causes a program to do the wrong thing, but not to display an error message. (Also ch. 6b.)

Chapter 3 — Functions

10 terms
TermDefinition
function definitionA statement that creates a function.
headerThe first line of a function definition.
bodyThe sequence of statements inside a function definition.
function objectA value created by a function definition. The name of the function is a variable that refers to a function object.
parameterAPA name used inside a function to refer to the value passed as an argument.
loopAPA statement that runs one or more statements, often repeatedly.
local variableA variable defined inside a function, and which can only be accessed inside the function.
stack diagramA graphical representation of a stack of functions, their variables, and the values they refer to.
frameA box in a stack diagram that represents a function call. It contains the local variables and parameters of the function.
tracebackA list of the functions that are executing, printed when an exception occurs.

Chapter 4 — Functions and Interfaces

11 terms
TermDefinition
interface designAPA process for designing the interface of a function, which includes the parameters it should take.
canvasA window used to display graphical elements including lines, circles, rectangles, and other shapes.
encapsulationThe process of transforming a sequence of statements into a function definition.
generalizationThe process of replacing something unnecessarily specific (like a number) with something appropriately general (like a variable or parameter).
keyword argumentAn argument that includes the name of the parameter.
refactoringThe process of modifying a working program to improve function interfaces and other qualities of the code.
development planA process for writing programs.
docstringAPA string that appears at the top of a function definition to document the function's interface. (Also ch. 6b.)
multiline stringA string enclosed in triple quotes that can span more than one line of a program.
preconditionA requirement that should be satisfied by the caller before a function starts.
postconditionA requirement that should be satisfied by the function before it ends.

Chapter 5 — Conditionals and Recursion

15 terms
TermDefinition
recursionThe process of calling the function that is currently executing.
modulus operatorAPAn operator, %, that works on integers and returns the remainder when one number is divided by another.
boolean expressionAPAn expression whose value is either True or False.
relational operatorAPOne of the operators that compares its operands: ==, !=, >, <, >=, and <=.
logical operatorAPOne of the operators that combines boolean expressions, including and, or, and not.
conditional statementAPA statement that controls the flow of execution depending on some condition. Informally, this is usually an if-statement (that might contain an elif and else).
conditionThe boolean expression in a conditional statement that determines which branch runs.
blockOne or more statements indented to indicate they are part of another statement. Statements in a block are frequently said to have the same scope.
branchOne of the alternative sequences of statements in a conditional statement.
chained conditionalA conditional statement with a series of alternative branches.
nested conditionalAPA conditional statement that appears in one of the branches of another conditional statement.
recursiveA function that calls itself is recursive.
base caseA conditional branch in a recursive function that does not make a recursive call.
infinite recursionA recursion that doesn't have a base case, or never reaches it. Eventually, an infinite recursion causes a runtime error.
newlineA character that creates a line break between two parts of a string.

Chapter 6 — Return Values

8 terms
TermDefinition
return valueAPThe result of a function. If a function call is used as an expression, the return value is the value of the expression.
side effectAny effect a function has other than returning a value, such as displaying output or drawing on a canvas.
pure functionA function that returns a value and has no side effects. (Also ch. 14.)
dead codePart of a program that can never run, often because it appears after a return statement.
incremental developmentAPA program development plan intended to avoid debugging by adding and testing only a small amount of code at a time.
scaffoldingCode that is used during program development but is not part of the final version.
Turing completeA language, or subset of a language, is Turing complete if it can perform any computation that can be described by an algorithm.
input validationChecking the parameters of a function to make sure they have the correct types and values

Interlude — Docstrings and Doctests

18 terms
TermDefinition
docstringAPA string at the beginning of a function that documents what the function does; unlike a comment, it is stored on the function and can be read by the program. (Python's name for what the exam calls program documentation.) (Also ch. 4.)
doctestAn example call and its expected result, written inside a docstring, that can be run automatically to check the function. (Python; not exam vocabulary.)
testingAPChecking that a program behaves correctly by running it on chosen inputs and comparing what comes out against what should have come out.
test caseAPA single input, paired with the result it should produce.
boundary caseA test case at the value where a function's behavior changes, such as zero, an empty string, or the first or last item.
edge caseA test case at an unusual or extreme input, where a function is most likely to be wrong.
expected valueWhat a test says the answer should be, as opposed to what the code actually produced.
passA test whose actual result matches its expected value. (Also ch. 7.)
failA test whose actual result does not match its expected value. (Also ch. 7.)
hand tracingAPWorking through code on paper line by line, writing down each variable's value, in order to find an error without running the program.
semantic errorAPAn error that lets the program run but produces a wrong result. (The exam calls this a logic error.) (Also ch. 2.)
roundoff errorAPA loss of precision that happens because a fixed number of bits cannot represent some numbers exactly. (Also ch. 7b.)
program purposeAPThe need a program serves, or the problem it solves; why it exists.
program functionAPWhat a program does when it runs, described as behavior.
program inputAPData a program receives while it is running.
program outputAPWhat a program produces: displayed text, a returned value, a file, a sound, a movement.
procedureAPThe exam's word for a named, reusable block of code, whether or not it returns a value. This book says function. In older languages the two words were distinct: a procedure returned nothing, a function returned a value.
regressionA bug that reappears in code that used to work. Tests exist mainly to catch these. (Professional vocabulary, not exam vocabulary.)

Chapter 7 — Iteration and Search

11 terms
TermDefinition
loop variableA variable defined in the header of a for loop.
file objectAn object that represents an open file and keeps track of which parts of the file have been read or written.
methodA function that is associated with an object and called using the dot operator. (Also ch. 15.)
updateAn assignment statement that give a new value to a variable that already exists, rather than creating a new variables.
initializeCreate a new variable and give it a value.
incrementIncrease the value of a variable.
decrementDecrease the value of a variable.
counterA variable used to count something, usually initialized to zero and then incremented.
linear searchAPA computational pattern that searches through a sequence of elements and stops when it finds what it is looking for.
passIf a test runs and the result is as expected, the test passes. (Also ch. 6b.)
failIf a test runs and the result is not as expected, the test fails. (Also ch. 6b.)

Interlude — Representing Data

18 terms
TermDefinition
bitAPA single binary digit, 0 or 1.
byteAPEight bits. Enough to hold one of 256 values.
binaryAPBase-2 representation, using only the digits 0 and 1.
decimalAPBase-10, the system you already use.
hexadecimalAPBase-16, using 0 through 9 and A through F. Four bits per digit, so one byte is exactly two hex digits.
digital dataAPValues represented in discrete steps, ultimately as bits.
analog dataAPValues that vary continuously and smoothly, with no steps.
samplingAPApproximating an analog signal by measuring it at regular intervals. Two independent settings: how often you measure (rate) and how precisely you record each measurement (bit depth).
ASCIIAPA table assigning a number from 0 to 127 to each of a small set of characters.
UnicodeAPA far larger table, covering the writing systems ASCII left out.
character encodingThe agreement about which numbers stand for which characters. Read bits with the wrong encoding and you get the right data as the wrong text.
RGBAPColor stored as three numbers, the amounts of red, green, and blue, each usually one byte.
overflow errorAPAn error that happens when a value is too large for the number of bits available to hold it.
roundoff errorAPA loss of precision that happens because a fixed number of bits cannot represent some numbers exactly. (Second reference — first defined by the interlude between chapters 6 and 7.)
lossless compressionAPReduces size while allowing the original to be reconstructed exactly.
lossy compressionAPReduces size further, but only an approximation of the original can be recovered.
compression ratioCompressed size divided by original size. (This book's own term; not exam vocabulary.)
run-length encodingA lossless scheme that replaces runs of a repeated value with the value and a count. (This book's own term; the exam names no specific algorithm.)

Chapter 8 — Strings and Regular Expressions

12 terms
TermDefinition
sequenceAn ordered collection of values where each value is identified by an integer index.
characterAn element of a string, including letters, numbers, and symbols.
indexAPAn integer value used to select an item in a sequence, such as a character in a string. In Python indices start from 0.
sliceA part of a string specified by a range of indices.
empty stringA string that contains no characters and has length 0.
objectSomething a variable can refer to. An object has a type and a value.
immutableIf the elements of an object cannot be changed, the object is immutable.
invocationAn expression — or part of an expression — that calls a method.
regular expressionA sequence of characters that defines a search pattern.
patternA rule that specifies the requirements a string has to meet to constitute a match.
string substitutionReplacement of a string, or part of a string, with another string.
shell commandA statement in a shell language, which is a language used to interact with an operating system.

Chapter 9 — Lists

9 terms
TermDefinition
listAPAn object that contains a sequence of values.
elementAPOne of the values in a list or other sequence.
nested listA list that is an element of another list.
delimiterA character or string used to indicate where a string should be split.
equivalentHaving the same value.
identicalBeing the same object (which implies equivalence).
referenceThe association between a variable and its value.
aliasedIf there is more than one variable that refers to an object, the object is aliased.
attributeOne of the named values associated with an object. (Also ch. 14.)

Chapter 10 — Dictionaries

12 terms
TermDefinition
dictionaryAn object that contains key-value pairs, also called items.
itemIn a dictionary, another name for a key-value pair.
keyAn object that appears in a dictionary as the first part of a key-value pair.
valueAn object that appears in a dictionary as the second part of a key-value pair. This is more specific than our previous use of the word "value". (Also ch. 1.)
mappingA relationship in which each element of one set corresponds to an element of another set.
hash tableA collection of key-value pairs organized so that we can look up a key and find its value efficiently.
hashableImmutable types like integers, floats and strings are hashable. Mutable types like lists and dictionaries are not.
hash functionA function that takes an object and computes an integer that is used to locate a key in a hash table. (Also ch. 13.)
accumulatorA variable used in a loop to add up or accumulate a result.
filteringAPLooping through a sequence and selecting or omitting elements.
call graphA diagram that shows every frame created during the execution of a program, with an arrow from each caller to each callee.
memoA computed value stored to avoid unnecessary future computation.

Chapter 11 — Tuples

6 terms
TermDefinition
packCollect multiple arguments into a tuple.
unpackTreat a tuple (or other sequence) as multiple arguments.
zip objectThe result of calling the built-in function zip, can be used to loop through a sequence of tuples.
enumerate objectThe result of calling the built-in function enumerate, can be used to loop through a sequence of tuples.
sort keyA value, or function that computes a value, used to sort the elements of a collection.
data structureA collection of values, organized to perform certain operations efficiently.

Chapter 12 — Text Analysis and Generation

8 terms
TermDefinition
default valueThe value assigned to a parameter if no argument is provided.
overrideTo replace a default value with an argument.
deterministicA deterministic program does the same thing each time it runs, given the same inputs.
pseudorandomAPA pseudorandom sequence of numbers appears to be random, but is generated by a deterministic program.
bigramA sequence of two elements, often words.
trigramA sequence of three elements.
n-gramA sequence of an unspecified number of elements.
rubber duck debuggingA way of debugging by explaining a problem aloud to an inanimate object.

Chapter 13 — Files and Databases

16 terms
TermDefinition
ephemeralAn ephemeral program typically runs for a short time and, when it ends, its data are lost.
persistentA persistent program runs indefinitely and keeps at least some of its data in permanent storage.
directoryA collection of files and other directories.
current working directoryThe default directory used by a program unless another directory is specified.
pathA string that specifies a sequence of directories, often leading to a file.
relative pathA path that starts from the current working directory, or some other specified directory.
absolute pathA path that does not depend on the current directory.
f-stringA string that has the letter f before the opening quotation mark, and contains one or more expressions in curly braces.
configuration dataData, often stored in a file, that specifies what a program should do and how.
serializationConverting an object to a string.
deserializationConverting a string to an object.
databaseA file whose contents are organized to perform certain operations efficiently.
key-value storesA database whose contents are organized like a dictionary with keys that correspond to values.
binary modeA way of opening a file so the contents are interpreted as sequence of bytes rather than a sequence of characters.
hash functionA function that takes and object and computes an integer, which is sometimes called a digest. (Also ch. 10.)
digestThe result of a hash function, especially when it is used to check whether two objects are the same.

Chapter 14 — Classes and Functions

12 terms
TermDefinition
object-oriented programmingA style of programming that uses objects to organize code and data.
classA programmer-defined type. A class definition creates a new class object.
class objectAn object that represents a class — it is the result of a class definition.
instantiationThe process of creating an object that belongs to a class.
instanceAn object that belongs to a class.
attributeA variable associated with an object, also called an instance variable. (Also ch. 9.)
object diagramA graphical representation of an object, its attributes, and their values.
format specifierIn an f-string, a format specifier determines how a value is converted to a string.
pure functionA function that does not modify its parameters or have any effect other than returning a value. (Also ch. 6.)
functional programming styleA way of programming that uses pure functions whenever possible.
prototype and patchA way of developing programs by starting with a rough draft and gradually adding features and fixing bugs.
design-first developmentA way of developing programs with more careful planning that prototype and patch.

Chapter 15 — Classes and Methods

8 terms
TermDefinition
object-oriented languageA language that provides features to support object-oriented programming, notably user-defined types.
methodA function that is defined inside a class definition and is invoked on instances of that class. (Also ch. 7.)
receiverThe object a method is invoked on.
static methodA method that can be invoked without an object as receiver.
instance methodA method that must be invoked with an object as receiver.
special methodA method that changes the way operators and some functions work with an object.
operator overloadingThe process of using special methods to change the way operators with with user-defined types.
invariantA condition that should always be true during the execution of a program.

Chapter 16 — Classes and Objects

3 terms
TermDefinition
shallow copyA copy operation that does not copy nested objects.
deep copyA copy operation that also copies nested objects.
polymorphismThe ability of a method or operator to work with multiple types of objects.

Chapter 17 — Inheritance

8 terms
TermDefinition
inheritanceThe ability to define a new class that is a modified version of a previously defined class.
encodeTo represent one set of values using another set of values by constructing a mapping between them.
class variableA variable defined inside a class definition, but not inside any method.
totally orderedA set of objects is totally ordered if we can compare any two elements and the results are consistent.
delegationWhen one method passes responsibility to another method to do most or all of the work.
parent classA class that is inherited from.
child classA class that inherits from another class.
specializationA way of using inheritance to create a new class that is a specialized version of an existing class.

Chapter 18 — Python Extras

5 terms
TermDefinition
factoryA function used to create objects, often passed as a parameter to a function.
conditional expressionAn expression that uses a conditional to select one of two values.
list comprehensionA concise way to loop through a sequence and create a list.
generator expressionSimilar to a list comprehension except that it does not create a list.
test discoveryA process used to find and run tests.