Tenth graders write robust programs that do not crash on bad input. Risky code goes in a try block; if it fails, an except block catches the error and recovers gracefully. They sort what goes in try vs except, then add error handling to a program.
Students will be able to…
How do you keep a program from crashing when something goes wrong?
Project this and sort each item into the try block (risky code) or the except block (handle the error).
Tap any phase to open the teacher moves and student actions.
What happens if a user types “cat” where a number is expected?
Students use the idea.
Students modify.
Students create.
Students close.
Aligned to the CSTA K-12 Computer Science Standards and the ISTE Standards for Students.
Evaluate and refine artifacts for correctness and robustness.
Decompose problems into components.
Iteratively develop programs using control structures.
Test for and handle edge cases.
Preview the three formative checks. Tap “Sample answer” to see what mastery looks like — hide them before you print for students.
Have students wrap one risky line in try/except with a friendly message. A printable error-handling worksheet is in the Computer Science library.
Tap a card to flip it, then rate whether you knew it. Built from this lesson’s vocabulary.
A quick self-check with instant feedback, drawn from this lesson’s key terms.
A print-and-go review sheet with a built-in answer key. Tap “Show answer key” to reveal answers, or print the clean version for students.