Python Basics: Conditional Logic and Control Flow

Ian Currie
Ian Currie 12 Lessons 1h 21m basics python

Much of the Python code you’ll write is unconditional. That is, the code doesn’t make any choices. Every line of code is executed in the order that it’s written or in the order that functions are called, with possible repetitions inside loops.

In this course, you’ll learn how to use conditional logic to write programs that perform different actions based on different conditions. Paired with functions and loops, conditional logic allows you to write complex programs that can handle many different situations.

In this Python Basics video course, you’ll learn how to:

  • Compare the values of two or more variables
  • Write if statements to control the flow of your programs
  • Handle errors with try and except
  • Apply conditional logic to create simulations

This video course is part of the Python Basics series, which accompanies Python Basics: A Practical Introduction to Python 3. You can also check out the other Python Basics courses.

Note that you’ll be using IDLE to interact with Python throughout this course.

What’s Included:

Downloadable Resources:

Related Learning Paths:

About Ian Currie

Ian is a Python nerd who relies on it for work and much enjoyment.

» More about Ian

Each tutorial at Real Python is created by a team of developers so that it meets our high quality standards. The team members who worked on this tutorial are:

← Browse All Courses