CHAPTER 12 VISUAL LAB - Observe failure, repair it, and verify the check
Book boards: 12a and 12b

PRACTICE ROUTINE
Cover the board answer. Predict aloud, try the example, compare with the
stated result, change one input, and try again. Explain a discrepancy
before changing another thing. All marketing examples are fictional.

Use boards 12a and 12b. Open walkthrough.py in Thonny and press F5. This lab
deliberately demonstrates two defects inside narrow try/except blocks so
the evidence remains visible and the script can proceed to the repair.

EXPECTED OUTPUT
Caught ZeroDivisionError before a rate was produced.
Ordinary case passed for the wrong function.
Zero-case assertion caught the wrong return value.
Repaired function passed the three stated checks.

FOLLOW THE CODE
The first failure occurs at division by zero. The second function avoids
that exception but incorrectly returns numeric zero. Its ordinary-case test
passes; its zero-case assertion fails. The repaired function returns None
for a known zero denominator, and the final assertions check ordinary,
zero-cost and zero-enquiry outcomes separately.

CHANGE, PREDICT, CHECK
In a practice copy, change the repaired function's return None to return 0.
Predict which final assertion will stop the script before running it.
Answer: assert calculate_rate(90, 0) is None fails. Restore the return value
and rerun to confirm recovery. A final success message is reached only after
the checks execute.

To inspect an unhandled traceback, separately open failure_only.py and run
it. It is intentionally broken and should stop with ZeroDivisionError.
The fuller python/chapter12.py also verifies negative-input rejection.
