Conditional Statements

In this lesson, we will go over conditional statements in Python.

We'll cover the following

A conditional statement is a boolean expression that, if True, executes a piece of code. It allows programs to branch out into different paths based on the outcome of boolean expressions:

if condition 1 is true:
    execute expression 1

if condition 2 is true:
    execute expression 2

else:
    execute expression 3

Conditional statements control the flow of the code and are classified as control structures.

Get hands-on with 1400+ tech skills courses.