Course Practicalities

Glossary


This glossary is meant as a practical reading aid. The definitions are intentionally short and course-oriented, so they are easier to use while studying the chapters.

A

  • Argument — A value passed to a function when it is called. In len(name), the variable name is the argument.
  • Arithmetic Operator — A symbol such as +, -, *, /, //, %, or ** that performs a calculation on numbers.
  • Assignment — Storing a value in a variable, using =. x = 5 assigns 5 to x.
  • assert — A statement that checks a condition and raises AssertionError if it is false. Used for small tests.

B

  • Block — A group of indented lines that belong together, such as the body of a function, an if, or a loop.
  • Boolean — A value that is either True or False.
  • Boundary Value — An input that sits exactly at the edge of a condition, such as 15 for a condition that uses < 15. A common source of off-by-one bugs.
  • break — A statement that ends a loop immediately, regardless of the loop’s condition.
  • Bug — A defect in a program: code that does not do what it is supposed to do.

C

  • Call — To run a function. A function call has the form name(arguments).
  • Comment — Text in the code that Python ignores. A comment starts with #.
  • Comparison Operator — A symbol such as ==, !=, <, <=, >, or >= that compares two values and returns a boolean.
  • Concatenation — Joining two strings end-to-end with +.
  • Condition — An expression evaluated as a boolean, used in if, while, and similar statements.
  • Conditional — A statement that runs different code depending on a condition: if, elif, else.
  • Control Flow — The order in which Python runs the lines of a program. Branching and looping change control flow.
  • Conversion — Turning one type of value into another, such as int("42") or str(45).

D

  • Debug Print — A temporary print added to a program to make a piece of its state visible while it runs.
  • Decomposition — Breaking a larger task into smaller steps that can be solved one at a time.
  • def — The keyword that begins a function definition.
  • Docstring — A string at the start of a function that describes what the function does. Doubles as documentation and as a reminder to your future self.

E

  • Edge Case — An unusual or boundary input that often exposes bugs: the empty list, the value exactly at a threshold, the user typing something unexpected.
  • elif — “Else if”: a branch that runs when an earlier if was false but its own condition is true.
  • else — A branch that runs when none of the preceding conditions were true.
  • Empty — A common edge case. An empty string is ""; an empty list is [].
  • Exception — A signal that something has gone wrong, raised either by Python or by your own code with raise.
  • Expression — A piece of code that evaluates to a value, such as 2 + 3 or name.upper().

F

  • f-string — A string with an f immediately before the opening quote, where any {expression} inside is replaced by the value of that expression. The preferred way to include values in printed text.
  • False — One of the two boolean values.
  • Float — A number with a decimal point, such as 3.14 or -0.5.
  • for Loop — A loop that runs its body once for each item in a collection: for item in collection:.
  • Function — A named, reusable piece of code that takes inputs (parameters) and usually returns a value.
  • Function Call — The act of running a function, written as name(arguments).
  • Function Definition — The lines that introduce a function, beginning with def.

G

  • Global Variable — A variable defined outside any function. Visible throughout the module, but read-only from inside functions unless explicitly declared global.

I

  • if Statement — A statement that runs its body when its condition is true.
  • Immutable — A value that cannot be changed after it is created. Strings, numbers, and tuples are immutable.
  • import — A statement that loads code from another module or library so it can be used.
  • Index — The position of an item in a collection, starting at 0. subjects[0] is the first item.
  • IndexError — An exception raised when you access an index that does not exist.
  • input — A built-in function that asks the user for a value and returns it as a string.
  • Input Validation — Checking that a function’s inputs make sense, and signaling a problem (usually by raising an exception) if not.
  • Integer (int) — A whole number, such as 42 or -7.
  • Iterable — Something a loop can walk through: a string, a list, a range, and many others.
  • Iteration — One single run through the body of a loop.

K

  • Keyword — A word that Python reserves for its own use, such as def, if, return, or for. You cannot use a keyword as a variable name.

L

  • len — A built-in function that returns the number of items in a string, list, or other collection.
  • List — An ordered, mutable collection of values, written in square brackets: [1, 2, 3].
  • Local Variable — A variable defined inside a function. It is only visible within that function and disappears when the function returns.
  • Loop — A construct that runs the same code multiple times: for or while.

M

  • Method — A function that belongs to a value, called using dot notation: "hello".upper().
  • Module — A file containing Python code that can be imported.
  • Mutable — A value that can be changed after it is created. Lists and dictionaries are mutable.

N

  • Name — A label that refers to a value. Created by assignment.
  • None — A special value that represents “no value” or “nothing”. Often used as a return value when a function has no meaningful answer to give.

O

  • Off-by-One — A common kind of bug where a loop runs one too many or one too few times, often caused by mixing up < and <= or by misusing range.
  • Operator — A symbol that performs an operation, such as +, *, ==, and, or not.

P

  • Parameter — A named placeholder in a function definition. Receives an argument value when the function is called. Inside the function, a parameter behaves like a local variable.
  • print — A built-in function that displays its argument.
  • Prompt — The text shown to the user by input(...) before they type.
  • Pure Function — A function whose return value depends only on its inputs and which has no side effects. Easier to test and reason about.

R

  • raise — A statement that signals an exception. Used in patterns like raise ValueError("bad input").
  • range — A built-in that produces a sequence of numbers, often used with for. range(5) produces 0, 1, 2, 3, 4.
  • Refactoring — Changing how code is organized without changing what it does. Extracting a function from inline code is a typical refactor.
  • REPL — Read-evaluate-print loop. An environment where you can type one expression at a time and see the result immediately.
  • return — A statement that ends a function call and gives back a value.
  • Return Value — The value a function produces when it is called.

S

  • Sandbox — The in-browser Python environment used for the first three parts of the course.
  • Scope — The region of the program where a variable is visible. Variables defined inside a function are in scope only within that function.
  • Side Effect — Anything a function does besides returning a value: printing, reading or writing a file, modifying a global variable, mutating a list passed in as an argument.
  • Slice — A sub-range of a string or list, written s[start:end]. The end index is excluded.
  • Specification — A short description of what a function takes, returns, handles on edge cases, and — when applicable — what exceptions it raises.
  • Statement — A line of code that does something, such as x = 5 or print(x).
  • String — A sequence of characters, written between quotes: "hello" or 'hello'.
  • Syntax — The grammar of the language: the rules about how programs must be written.
  • Syntax Error — An error reported when the code breaks the grammar of the language, such as a missing parenthesis.

T

  • Test — A small piece of code that checks whether another piece of code behaves as expected. In this course, tests are usually written with assert.
  • Trace — The activity of walking through a program line by line, writing down what each variable holds, to understand what the program does.
  • Traceback — The multi-line error report Python prints when an unhandled exception occurs. The last line names the exception type and message; the lines above show where in the program it happened.
  • True — One of the two boolean values.
  • try / except — A construct that catches an exception raised inside the try block and runs the except block instead of crashing.
  • Truthy / Falsy — Values that count as True or False in a boolean context, even though they are not literally True or False. An empty string and an empty list are falsy; non-empty ones are truthy.
  • Type — A category of values, such as int, str, list, or bool. Operations behave differently depending on type.
  • TypeError — An exception raised when an operation is applied to a value of the wrong type, such as "5" + 3.

V

  • Value — A piece of data, such as 42, "hello", or [1, 2, 3].
  • ValueError — An exception raised when a value has the right type but the wrong content, such as int("forty-five").
  • Variable — A named storage location for a value, created by assignment.

W

  • while Loop — A loop that runs as long as its condition is true. Useful when the number of iterations is not known in advance.