Skip to main content

Practice ยท 2 of 4

Catch the Right Thing

Write fetch_score(data) that returns data["score"] as an int, but returns -1 when the key is missing. Do NOT catch every exception โ€” catch only the one that a missing key raises.

Difficulty: beginner

Back to lesson: Practice: Traceback Reading