promptdojo_

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.

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