Section 23.8 Chapter Summary
This chapter included the following concepts from computing.
- Boolean Expression - A Boolean expression is one that is either true or false. This is also called a logical expression.
- Condition - A condition is something that is either true or false. This is also called a Boolean expression or a logical expression.
- Conditional Execution - Conditional execution means that one or more statements are executed only when a condition (logical expression) is true. This is also called a conditional. The statements that are executed when the condition is true are called the body.
- Flowchart - A flowchart is a diagram that shows the execution paths for a program. The conditionals are shown as diamonds.
- Logical Expression - A logical expression is one that is either true or false, like
x == 3
which will return true if x is equal to 3. This is also called a Boolean expression.
Subsection 23.8.1 Summary of Python Keywords and Functions
- Else - The keyword
else
is used to execute one or more statements in a block following theelse
when the condition in theif
part of the statement is false. Anelse
must always have anif
statement before it. - Elif - The keyword
elif
is used when you want to have a conditional with 3 or more possible options. Add as manyelif
statements as you need after anif
and before aelse
. - If - The Python keyword
if
is used to start a condition. It is followed by a Boolean expression and then has one or more statements in the body of the loop which are executed only if the Boolean expression is true.
You have attempted 1 of 1 activities on this page.