promptdojo_

print and breakpoint — finding the bad value before AI does — step 9 of 9

Checkpoint

One last thing before we move on. Same surface as a write step — but the lesson doesn't complete until this passes.

Final drill. The function safe_divide has a subtle bug — when b is 0 it returns None instead of the string "undefined". Add print-tracing and fix the bug so the output is exactly:

trace: a=10, b=2
5.0
trace: a=10, b=0
undefined

The trace: line goes at the start of the function on each call. The bug fix goes inside the function body.

full-screen editor opens — close anytime to keep reading.