Catching the right error — not 'anything that goes wrong' — step 7 of 9
AI wrote two except clauses for parse_age. The intent: missing key
returns -1, bad string returns 0. But the classes got swapped — the
body raises ValueError for int("n/a"), but that branch returns -1
instead of 0.
Fix the two except lines so that calling parse_age({"age": "n/a"})
prints 0 (bad parse → 0).
The break is on lines 4, 6 — but read the whole snippet first.
⌘↵ runs the editor.read, then continue.
AI wrote two except clauses for parse_age. The intent: missing key
returns -1, bad string returns 0. But the classes got swapped — the
body raises ValueError for int("n/a"), but that branch returns -1
instead of 0.
Fix the two except lines so that calling parse_age({"age": "n/a"})
prints 0 (bad parse → 0).
The break is on lines 4, 6 — but read the whole snippet first.
this step needs the editor
on desktop today; in the app (coming soon). save your spot and we'll bring you back here when you're ready.