Control Structures has a comprehensive discussion on control flow and structures concepts in programming. This page deals specifically with control structures within Python.

Conditional Statements

Conditionals take an expression, which is code that evaluates to determine a value, and checks if it is True or False. If it’s True, we can tell our program to do one thing — we can even account for False to do another. As we write more complex programs, conditionals allow us to address multiple scenarios and make our programs more robust.

The Python if statement is used to determine the execution of code based on the evaluation of a Boolean expression.

Boolean Expressions

Boolean expressions can only be True or False

today = “Monday” # a string representing the day of the week
is_weekend = False # a boolean expression to determine if its the weekend

Relational Operators: Equals and Not Equals

Relational operators compare two items and return either True or False. For this reason, you will sometimes hear them called comparators.