1/24
Vocabulary flashcards covering procedural knowledge, boolean expressions, relational and Boolean operators, and Python conditionals (if, elif, else) including indentation and common patterns.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Boolean Expressions
Expressions that evaluate to True or False and are used to control program flow in conditionals.
Relational Operators
Operators that compare two values to produce a Boolean result (e.g., \text{==}, \text{!=}, \text{
Equality (==)
Operator that checks if two values are equal; note that \text{=} is used for assignment.
Assignment (=)
Operator that assigns a value to a variable.
Inequality (!=)
Operator that tests whether two values are not equal.
Less Than (<)
Operator that tests whether one value is smaller than another.
Greater Than (>)
Operator that tests whether one value is larger than another.
Less Than or Equal (<=)
Operator that tests whether a value is less than or equal to another.
Greater Than or Equal (>=)
Operator that tests whether a value is greater than or equal to another.
Boolean Operators
Operators that combine Boolean values: \text{and}, \text{or} , \text{not}.
and
True only if both operands are True; otherwise False.
or
True if at least one operand is True; otherwise False.
not
Logical negation that inverts a Boolean value.
Order of Operations (Boolean Expressions)
Rules for evaluating expressions: \text{not} before \text{and} before \text{or}; relational operators before Boolean operators; use parentheses for clarity.
Parentheses
Used to group parts of an expression to enforce order of evaluation.
Boolean Literals
The literals \text{True} and \text{False} used as Boolean values in conditions.
Between 0 and 100 Inclusive
A common range check example: \text{(variable >= 0) and (variable <= 100)}.
Conditional
A programming construct that selects a branch of code to execute based on a boolean condition.
Sequential
A programming construct where statements are executed one after another in order.
Indentation
In Python, indentation defines blocks of code; four spaces per level is common and required for blocks.
The if Statement
A conditional that introduces a branch; format: \text{if
The if-else Statement
Conditional with two branches: execute the first block if condition is True; otherwise execute the \text{else} block.
The if-elif-else Statement
Multiple conditional branches; the first True condition's block is executed; others are skipped until \text{else}.
Nested Branches
An \text{if/elif/else} statement inside another conditional block to reflect complex logic; requires consistent indentation.
First True Expression Wins
In an \text{if-elif-else} chain, the first condition that evaluates to True is executed and later conditions are ignored.