Python · Lesson 3.2 · Pro
if, elif and else
Run different code depending on a condition, with as many branches as you need.
In this lesson
- if: run code only sometimes
- else: the other case
- elif: more than two cases
- Nested decisions
Go Pro to read this lesson
Pro unlocks every lesson and practice problem in SQL, Python, pandas and NumPy, with answers and step-by-step explanations.