tracebacks — cursor wrote this and crashed9 / 9
print and breakpoint — finding the bad value before ai does
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.
⌘↵ runs the editor.
Booting Python…
Output
[promptdojo:~]$ _