Everything you need before the bell rings
Learning Objectives
Students will be able to…
- ✓Use try / except.
- ✓Put risky code in try.
- ✓Recover in except.
- ✓Make a program robust.
How do you keep a program from crashing when something goes wrong?
try Block or except Block?
Project this and sort each item into the try block (risky code) or the except block (handle the error).
55 minutes, five moves
Tap any phase to open the teacher moves and student actions.
Hook — When It All Goes Wrong
What happens if a user types “cat” where a number is expected?
👩🏫 Teacher Moves
- Show a program crashing.
- Ask how to prevent it.
- Set the goal.
🎒 Student Actions
- Look.
- Guess.
- Get ready.
Use — Error Handling
Students use the idea.
👩🏫 Teacher Moves
- Send students to try or except?
- Sort each item.
- Note risky code vs recovery.
🎒 Student Actions
- Sort.
- Say.
- Note it.
Modify — Catch It
Students modify.
👩🏫 Teacher Moves
- Wrap risky code in a try.
- Add an except to recover.
- Test a bad input.
🎒 Student Actions
- Wrap.
- Add.
- Test.
Create — Make It Robust
Students create.
👩🏫 Teacher Moves
- Add try/except to a program.
- Give a friendly message.
- Use a safe default.
🎒 Student Actions
- Add.
- Message.
- Default.
Reflect — Reflect
Students close.
👩🏫 Teacher Moves
- Say what goes in try.
- Say what except does.
- Complete the exit ticket.
🎒 Student Actions
- Say it.
- Say.
- Complete the exit ticket.
Built to the standards you report on
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.
One lesson, every learner
Multilingual Learners
- Act out “try, then catch.”
- Frame: “risky here, recover there.”
- Pair talk first.
Support & Access
- Sort try vs except only.
- Wrap one risky line.
- Use a template.
Stretch & Extend
- Catch specific error types.
- Add a finally block.
- Validate input before trying.
What to gather
- 📽️Screen / board
- 🛡️try/except cards
- 💻try or except?
- 🐍Python / editor
- 📓Notebooks
- 🎫Exit-ticket slips
Key terms — hover for a quick definition
Exit Ticket
Preview the three formative checks. Tap “Sample answer” to see what mastery looks like — hide them before you print for students.
Reflect: error handling.
Have students wrap one risky line in try/except with a friendly message. A printable error-handling worksheet is in the Computer Science library.
Study the key terms
Tap a card to flip it, then rate whether you knew it. Built from this lesson’s vocabulary.
Nice work!
Check your understanding
A quick self-check with instant feedback, drawn from this lesson’s key terms.
Nice work!
Printable worksheet
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.
Part A · Write the word that matches each meaning
- to handle an error instead of crashing
- block holding code that might fail
- check input before using it
- a safe fallback value
- block that runs if the try fails
- keeps working on bad input
- the program stops with an error
- a problem that interrupts a program
Part B · Show what you learned
- What goes in a try block?
- What does an except block do?
- Why handle errors?
Part B: 1) Risky code that might fail. 2) Catches the error and recovers gracefully. 3) So the program does not crash on bad input.