The Problem: Code Without Control Flow

Imagine you’re writing your first Python programs. So far, maybe you’ve learned how to:

But, there’s a big limitation:

Every line of your code runs in order, from top to bottom, with no way to “make decisions” or “repeat” actions.

In real life, we need our programs to:

Real-World Analogy

Think of control flow like road signs and traffic lights in a city:

Types of Control Flow in Python

There are Two core ways Python lets you control how your code runs: