Branch code execution with the if...elif...else statement in Python

Beginner
Developer
Visual Studio

Use the if statement Boolean expressions with comparison and logic operators to express decision logic.

In this module, you will:

  • Use the if ... elif ... else statements to add decision logic to your Python code.
  • Understand the Boolean data type and what it represents in Python.
  • Compose Boolean expressions by using a rich set of comparison and logic operators.

Prerequisites

  • You should have your Python development environment already set up and know how to create, edit, and execute Python code stored in a .py file.
  • You should have exposure to the use of input and output functions like print() and input().
  • You should know how to create and assign values to variables.