Functions · warm-up
Divide safely
Write safe_divide(a, b) returning a / b, or None when b is 0 — without letting Python raise an error.
- right answers
- arguments left as they should be
Run adds print(safe_divide(1, 0)) after your code, to try it.
Stuck on the idea rather than the code? The Defaults and guard clauses lesson walks through it.