Conditionals — Conditional Statements

When students understand the basic concepts of creating and evaluating Boolean expressions, they can use them to control conditional statements. The syntax for using conditionals in Python is listed below:

Python Syntax: if Statement

if boolean_expression:
    indented block of statements

if boolean_expression:
    indented block of statements
else:
    indented block of statements

Python Syntax: if-elif Statement

if boolean_expression_1:
    indented block of statements
elif boolean_expression_2:
    indented block of statements
else
    indented block of statements

Python Syntax: while Statement

while boolean_expression:
    indented block of statements

The following video introduces the Python if and while statements.  The if, else, and elif variations are all shown. Video Length: 6:55