1/26
Vocabulary flashcards defining fundamental concepts of Python Chapter 4, including Boolean logic, comparison and logical operators, branching structures (if, elif, else), nested and chained decisions, operator precedence, conditional expressions, and standard runtime/syntax errors.
Condition
An expression that evaluates to either true or false (truthy or falsy) to determine the flow of program execution.
Branch
A specific path or block of code selected for execution based on the evaluation of a conditional test.
Boolean (bool)
A built-in Python data type containing precisely two values: True and False (both capitalized).
Truthy
A property of any value that evaluates to True in a conditional statement, including nonzero numbers, nonempty strings, and nonempty collections.
Falsy
A property of any value that evaluates to False in a conditional statement, such as numeric zero (0, 0.0), empty strings (""), empty collections ([], {}), None, and False.
Equality Operator (==)
A comparison operator that checks whether the values or contents of two operands are equal.
Assignment Operator (=)
An operator used to assign and store a value into a variable, distinct from the equality comparison operator ==.
Identity Operator (is)
An operator that tests whether two references point to the exact same object in memory, rather than merely having equal values.
if Statement
A control flow statement that executes its indented code block only when its condition evaluates to a truthy value.
else Statement
An optional clause paired with an if statement at the same indentation level that executes its indented body only when the preceding condition evaluates to a falsy value.
elif Statement
A keyword standing for 'else if' that specifies an alternative condition to test only if all preceding branches in the decision chain evaluated to false.
Logical and Operator
A Boolean operator that evaluates to True only when both operands or conditions are true.
Logical or Operator
A Boolean operator that evaluates to True if at least one of its operands or conditions is true.
Logical not Operator
A unary Boolean operator that inverts or reverses the truth value of its operand.
Short-circuit Evaluation
The evaluation strategy where Python stops checking remaining operands in a logical expression as soon as the final result is determined (e.g., if the left side of and is false, or the left side of or is true).
Operator Precedence
The formal rules determining the order in which different operators are grouped and evaluated in an expression.
Associativity
The directional order (such as left-to-right for multiplication and division, or right-to-left for exponentiation) in which operators with equal precedence are grouped and evaluated.
Chained Decision
A multi-way decision structure using if/elif/else that evaluates conditions sequentially from top to bottom and executes at most the first matching branch.
Nested Decision
A decision structure placed inside the indented body of another if or else statement, requiring an additional level of indentation.
Chained Comparison
A concise Python comparison format (such as 13≤age<18) that tests multiple relational boundary conditions simultaneously without an explicit and operator.
Conditional Expression
A single-line ternary construct with the syntax value_if_true if condition else value_if_false used to select a value based on a condition.
Modulo Operator (%)
An arithmetic operator that returns the integer remainder of a division, frequently used to check divisibility or whether a number is even (number%2==0).
pass Statement
A null statement in Python used as a temporary placeholder inside an empty code block to avoid indentation or syntax errors during development.
SyntaxError: expected ':'
A syntax error produced when an if, elif, or else header line is missing its required trailing colon (:).
IndentationError
An error raised when a code block has inconsistent spacing or fails to indent lines underneath a header (conventionally four spaces).
TypeError (Relational Comparison)
An error triggered in Python 3 when attempting to compare incompatible data types (such as a string and an integer) using relational operators like < or >.
ValueError (int conversion)
An error that occurs when int() is called on an input string containing nonnumeric characters that cannot be parsed as an integer.