Module 2: Making Decisions Flashcards
True and False belong to type _____.
bool
x is not equal to y given by _____
!=
x is equal to y given by _____
==
x is greater than or equal to y given by ______
> =
x is less than or equal to y given by ____
<=
and, or and not are _______.
logical operators.
_______ are a header followed by an indented body.
compound statements
_____ limit on number of statements that can appear in the body but must have _____.
no, 1
to have a body with no statements use the ______ statement.
pass
___________ is a second form of if statement when there are two possibilities and the condition determines which one runs.
alternative execution
________ is when there are more than two possibilities and we need more than two branches.
chained conditionals
chained conditionals use: ________
if, elif, else or if, elif, elif
alternative execution uses ________.
if, else
alternatives are also called ________
branches
_______ is when an outer conditional has inner conditionals
nested conditional
a function that returns a boolean is a _______
predicate/predicate function
boolean function names sound like _________
yes/no questions
useful parts of an error message are ______ and _______.
what kind of error it was, where it occurred
_______ is an operator that compares its operands
relational operator
a _________ consists of a header and a body. the header ends with a : and body is indented relative to the header.
compound statement
a ________ causes a function to end immediately and return to the caller.
return statement
___________ is when a variable has a value and then gets a new value.
reassignment
________ is a kind of reassignment where the new value of the variable depends on the old.
update
before a variable can be updated, it must first be _______ with a simple assignment.
initialized
Updating a variable by adding or subtracting 1 is called an _______ or ______.
increment, decrement
The in-place operators for updating variables are:
x = x+a
x = x-a
x = x*a
x = x/a
x = x**a
x = x//a
x = x%a
x +=a
x -=a
x *=a
x /=a
x **=a
x //=a
x %=a