Lesson 2 of 21 · 2 min
What is Control Flow?
The WHY — Why Does Control Flow Exist?
Without control flow, every Python program would run the same way every time — one line after another, top to bottom, no choices, no repetition. That would be incredibly limiting.
Control flow lets programs:
- Make decisions — run different code depending on a condition
- Repeat actions — do something multiple times without copying code
Every useful program in the world uses control flow. A Netflix recommendation engine asks "if the user likes action movies, show action movies." A bank app repeats "while the user has not confirmed, keep showing the PIN entry screen."
