← all tracks/Python Basics

Conditionals

Conditionals: Making Decisions 🤔

So far, your programs have always run every line, top to bottom, no matter what. Conditionals let your program make choices — running different code depending on whether something is True or False.

This unit covers:

  • if — run code only when a condition is true
  • if / else — run one thing or another
  • if / elif / else — choose between several options
  • combining conditions with and, or, and not (you already know these from the last unit!)

This is where your programs start feeling truly alive — reacting differently depending on what's given to them.

# problems