1/23
Vocabulary practice flashcards covering while loops, for loops, range, nested loops, break, continue, loop else, and enumerate constructs in Python.
Loop
A program construct that repeatedly executes a sequence of statements (known as the loop body) while a controlling expression evaluates to true.
Loop body
The indented block of statements within a loop that executes repeatedly during each cycle as long as the loop condition remains true.
Iteration
A single execution of the statements contained within a loop's body.
While loop
A statement construct that repeatedly executes its body of sub-statements as long as its loop expression evaluates to True, terminating once the condition evaluates to False.
Sentinel value
A specific input value used to signal the end of data entry and terminate a loop's execution.
Infinite loop
A loop that never ceases execution because its controlling condition always evaluates to True.
Euclid's algorithm
An algorithm that computes the greatest common divisor (GCD) of two integers by continually subtracting the smaller value from the larger until both values are equal.
Docstring
A multi-line string literal delimited at the beginning and end by triple quotes (single or double) used to describe and document code.
Loop variable
A variable that is systematically updated during each iteration of a loop to count iterations or control loop execution.
Factorial (N!)
The mathematical product of all positive integers less than or equal to N, defined as N!=N×(N−1)×(N−2)×...×1.
For loop
A statement that iterates through each element of a container or sequence one at a time, assigning the element to a loop variable for each cycle.
Dictionary iteration
The process of looping through a dictionary with a for loop, which assigns the loop variable to each key of the dictionary in the order of insertion.
reversed()
A built-in function that reverses the order of elements in a sequence, allowing a for loop to iterate backward from the last element to the first.
range()
A built-in function that generates an arithmetic sequence of integers between an inclusive starting integer, an exclusive ending integer, and an optional step value.
Range object
An immutable sequence type representing an arithmetic progression of integers, commonly created by calling the range() function for use in for loops.
Nested loop
A loop construct placed entirely within the body of another loop, commonly referred to as an outer loop and an inner loop.
ord() and chr()
Built-in conversion functions where ord() returns the ASCII/Unicode encoded integer of a character (e.g., 'a' to 97) and chr() converts an encoded integer back into a character.
Incremental programming
A development practice where a programmer starts with a simple working version of a program and adds features little by little to simplify debugging.
FIXME comment
A standardized comment placed within source code to attract attention to sections that are incomplete or require future modification.
break statement
A control statement inside a loop body that causes immediate termination and exit from the enclosing loop.
continue statement
A control statement inside a loop that causes execution to jump immediately to the loop header for the next iteration.
Loop else construct
An optional clause in a while or for loop that executes once only if the loop completes normally without encountering a break statement.
enumerate()
A built-in function that yields a tuple containing the position index and corresponding element value at each step of sequence iteration.
Unpacking
A process that performs multiple assignments simultaneously by binding comma-separated variable names on the left to elements of a sequence on the right.