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 trueif/else— run one thing or anotherif/elif/else— choose between several options- combining conditions with
and,or, andnot(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.