Conditionals
if runs a block only when its condition is true. elif ("else if") gives
Python another condition to check when the first one fails, and else catches
whatever's left over. They're checked top to bottom, and only the first
matching branch runs.
Indentation is the block, in Python - there are no curly braces. Everything
lined up under an if (or elif, or else) belongs to that branch; the next
line back at the original indent level is outside it again.
Your task: write a function classify(n) that returns "positive" if n
is greater than 0, "negative" if it's less than 0, and "zero" otherwise.
You'll practice:
- Branching with
if / elif / else
- Returning different values from different branches