1/34
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
Assigning a value to a variable.
What does = mean in Python?
Either True or False.
What will the output of a conditional operator always be?
Whether the left side and right side are equal to each other.
What does == check?
Whether the left side and right side are not equal to each other.
What does != check?
Whether the left side is greater than the right side.
What does > check?
Whether the left side is less than the right side.
What does < check?
Whether the left side is greater than or equal to the right side.
What does >= check?
Whether the left side is less than or equal to the right side.
What does <= check?
= assigns a value; == checks if two values are equal.
What is the difference between = and ==?
True, because both values are equal.
What does 2 == 2 produce?
A keyword that has a specific meaning in Python and cannot be used as a variable name.
What is a reserved keyword?
if, elif, and else.
Which conditional keywords cannot be used as variable names?
if condition: followed by an indented instruction.
What is the basic syntax of an if statement?
A colon :.
What must come after the condition in an if statement?
Indentation.
What must be used before the instruction inside an if statement?
There will not be any output, not even a False.
What happens if an if condition is false?
Yes, as long as they have the same indentation.
Can more than one instruction be written inside an if statement?
To show that they belong to the same if block.
Why must multiple instructions inside an if statement have the same indentation?
if must come first and else must come after it.
What order must if and else follow?
No. No condition is written after else.
Does else have a condition?
The instruction inside the if block is executed.
What happens when the if condition is true in an if-else statement?
To check more than one condition.
Why is an if-elif-else statement used?
Yes, there can be as many elifs as needed.
Can there be more than one elif?
Its instruction is executed, and Python stops checking the conditions below it.
What happens when the first condition in an if-elif-else statement is true?
They are not checked or executed.
What happens to the conditions below the first true condition?
The first condition Python checks that evaluates to True.
What does “the first true condition” mean?
Only one branch, the first true branch.
How many branches are executed in one if-elif-else statement?
The else branch is executed.
What happens if none of the if or elif conditions are true?
Having another if/elif/else statement inside an if/else statement.
What is a nested conditional statement?
Inside the instructions of another conditional statement.
Where can another conditional statement be placed in a nested conditional?
One conditional statement is placed inside another conditional statement.
What does “nested” mean in conditional statements?
Indentation.
What determines which instructions belong to a conditional block?
No. It executes only the first true condition.
In an if-elif-else statement, does Python execute every true condition?
It stops the operation and does not look at anything below the true condition.
What happens after Python executes the first true condition?
Only one output/branch is executed.
What is the key rule to remember about each if-elif-else statement?