conditionals — where ai silently bugs9 / 9
elif chains and the match statement cursor reaches for
Checkpoint
One last thing before we move on. Same surface as a write step — but the lesson doesn't complete until this passes.
Last one. Cursor wrote a function that classifies an HTTP status code into
a category — "ok", "redirect", "client error", "server error", or
"weird". The elif chain is mostly there but the function never returns
anything (only the pass placeholder is at the bottom).
Replace the body so the function uses a chain that returns the right category for each range:
200..299→"ok"300..399→"redirect"400..499→"client error"500..599→"server error"- anything else →
"weird"
The script calls classify(404) and should print client error.
⌘↵ runs the editor.
Booting Python…
Output
[promptdojo:~]$ _