← Courses

Python for AI — Beginner Foundations

Data Science

Control Flow · Lesson 32 of 76

Control flow

Control flow is how a program decides what to do and how often. Two tools cover most of it:

  • Decisions with if / elif / else — do different things in different cases.
  • Repetition with loops — do something many times.

They're even more powerful together — a decision inside a loop:

Python

That tiny pattern — loop over data, decide on each item — is the backbone of countless real programs.

Your turn: change the pass mark from 50 to 70 and run it again.

You’re reading for free. Sign in to keep your progress and earn a certificate when you finish.Sign in to keep my progress →