Week 24 — Debugging — reading an error message on purpose¶
At a glance
| Date | Friday, February 19, 2027 |
| Unit | 3 — From Blocks to Text |
| Big idea | Error messages are clues; a traceback is the computer pointing to where it got confused. |
| Goal | Students intentionally break short Python programs, read the error, and fix one bug at a time. |
| Student accounts needed | None. MakeCode Arcade runs in the browser without sign-in. |
| Prep time | 5 minutes |
Why this lesson looks the way it does¶
This may be the highest-leverage lesson in the unit. Many students learn syntax by fear: red text means 'I am bad at this.' Today reverses that. Red text means the computer left a clue. Model calm: break code on purpose, read the last line out loud, fix one thing, and run again.
The mixed-age strategy stays explicit: Starters never face a blank page, Builders work from a template, and Extenders add features or write from scratch. Driver/Navigator pairing is not just classroom management here; it shares the typing load and makes students verbalize syntax.
CSTA 2026 standards¶
| Concept area | Connection |
|---|---|
| Algorithms & Design | Students design, test, and revise small programs within constraints |
| Programming | Students read and write Python syntax for the week's concept |
| Data & Analysis | Students use program output or test results as evidence |
| Systems & Security | Students work in no-account browser tools and avoid private information |
| Computing & Society | Students explain technical work clearly to an audience |
"I can…" objectives¶
By the end of today, students can say:
- I can read the main Python pattern for today's lesson.
- I can make and test a small change to working code.
- I can explain one important line to my partner.
- I can use evidence from running the code before claiming it works.
Teacher prep — the 5-minute version¶
- Open https://arcade.makecode.com and switch to Python.
- Paste the mini-lesson code below and run it once.
- Put this on the board: Run → Predict → Change one thing → Test.
- Pair students Driver/Navigator and plan the 0:24 swap.
- Keep Week 18–22 examples nearby for students who need a remix base.
Minute-by-minute run sheet¶
0:00–0:04 — Anchor¶
"Last Friday we named our own instructions with functions. Today we keep building in Python, but the win is still the same: understand a small program well enough to change it and test it."
0:04–0:12 — Mini-lesson¶
Break this code live by removing the colon, then read the final error line before fixing it.
"The important line is the last line.
SyntaxError: expected ':'is not saying the whole program is bad. It is saying, 'I expected a colon here.'"
Then break indentation and read: IndentationError: expected an indented block after 'if' statement.
0:12–0:36 — Paired build¶
"Driver, type only what your pair understands. Navigator, your job is to stop the pair from making five changes before testing one."
Tiered challenges¶
🟢 Starter (grades 5–6): modify working starter code
Fix the missing quote, then change the message.
hero = sprites.create(img("""
. 4 4 .
4 4 4 4
. 4 4 .
"""), SpriteKind.player)
hero.say_text("Hello)
🟡 Builder (grades 7–8): write from a template
Fix the two syntax bugs.
Then change the condition so the other message prints.
🔴 Extender (grades 9–10): write from scratch or add features
Find the scope bug with a test, then fix it.
Add a second call and predict the output.
0:36–0:42 — Share-out¶
"Do not show us perfect code. Show us an error you fixed. Read the error message and tell us which word helped you."
0:42–0:45 — Teaser + prompt¶
"Next Friday we connect this to AI. An AI assistant can write code quickly, but you cannot verify code you do not understand."
🤔 Think About This¶
Notice one error message this week outside coding. What clue did the message give you?
Share-out prompt¶
"Do not show us perfect code. Show us an error you fixed. Read the error message and tell us which word helped you."
🔌 Unplugged Plan B — if the internet is down¶
| Time | Activity |
|---|---|
| 0:00–0:04 | Same anchor: connect to last Friday and name today's target. |
| 0:04–0:12 | Board model with paper code cards. Underline names, circle punctuation, and box indented blocks. |
| 0:12–0:26 | Pairs run a paper "human interpreter" trace. One student reads exactly; one student records output or error. |
| 0:26–0:36 | Pairs modify one card, trade with another pair, and test again. |
| 0:36–0:42 | Share one working change and one bug found by reading carefully. |
| 0:42–0:45 | Same teaser and Think About This. |
Common problems & fixes¶
| Problem | What students may see | Fix |
|---|---|---|
Missing colon after if, for, or def |
SyntaxError: expected ':' |
Add a colon at the end of the header line. |
| Inconsistent indentation | IndentationError: unindent does not match any outer indentation level |
Make lines in the same block line up exactly. |
| No indentation after a header | IndentationError: expected an indented block after 'if' statement |
Indent the line that belongs inside the block. |
| Mismatched quotes | SyntaxError: unterminated string literal |
Check every string starts and ends with the same quote mark. |
Using = in a condition |
SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='? |
Use = to store; use == to compare. |
| Misspelled name | NameError: name 'socre' is not defined |
Match the spelling where the variable was created. |
Vocabulary¶
- Debugging — finding and fixing problems in code
- Traceback — an error report that points to where Python got confused
- Syntax error — code punctuation or structure Python cannot read
- Indentation error — spaces do not match the program structure
- Name error — Python sees a name it does not know
Reflection — fill in after class¶
- Which students could explain their code without prompting?
- Which syntax issue slowed the room down?
- Did pairs test one change at a time?
- What should carry into next week?
Next week: Week 25 — Coding with an AI assistant — and checking its work