Week 25 — Coding with an AI assistant — and checking its work¶
At a glance
| Date | Friday, February 26, 2027 |
| Unit | 3 — From Blocks to Text |
| Big idea | AI-generated code is a draft; programmers must understand, test, and verify it. |
| Goal | Students watch an AI assistant generate a small Python program, then evaluate it with tests before trusting it. |
| Student accounts needed | None for students. Teacher demo only; students do not need AI accounts. |
| Prep time | 5 minutes |
Why this lesson looks the way it does¶
This is not a lesson about outsourcing coding to AI. It is a lesson about judgment. Unit 2 taught that AI can be useful and confidently wrong; Week 24 taught that errors are clues. Keep the AI on the projector. Students do not need accounts. Their job is to read the code, predict behavior, design tests, and decide whether the draft is trustworthy.
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 | Test cases evaluate whether a proposed solution meets requirements |
| Programming | AI-generated code must be read, run, debugged, and revised before use |
| Data & Analysis | Evidence from test results supports or rejects a correctness claim |
| Systems & Security | AI tools should not be trusted with private data or unverified code |
| Computing & Society | People remain responsible for evaluating automated outputs |
"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 learned to read error messages instead of fearing them. 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¶
Teacher-demo an AI prompt on the projector, or reveal this prepared draft if the tool is unavailable.
score = 0
hero = sprites.create(img("""
. 7 7 .
7 7 7 7
. 7 7 .
"""), SpriteKind.player)
def on_a_pressed():
global score
score = score + 1
hero.say_text("Score: " + str(score))
controller.A.on_event(ControllerButtonEvent.PRESSED, on_a_pressed)
"We do not trust this because it looks like code. First we make tests: start score, press A once, press A three times. Fast is not the same as correct."
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
Use the tested draft. Change only the label, then retest.
score = 0
hero = sprites.create(img("""
. 7 7 .
7 7 7 7
. 7 7 .
"""), SpriteKind.player)
def on_a_pressed():
global score
score = score + 1
hero.say_text("Points: " + str(score))
controller.A.on_event(ControllerButtonEvent.PRESSED, on_a_pressed)
🟡 Builder (grades 7–8): write from a template
Add a B button that resets the score, then write two tests for it.
score = 0
hero = sprites.create(img("""
. 6 6 .
6 6 6 6
. 6 6 .
"""), SpriteKind.player)
def show_score():
hero.say_text("Score: " + str(score))
Complete the A and B events only after predicting results.
🔴 Extender (grades 9–10): write from scratch or add features
Evaluate this AI-style bug.
Explain the failure, fix it, and write the test that proved the fix.
0:36–0:42 — Share-out¶
"Do not just say, 'It worked.' Tell us the test: prediction, action, result."
0:42–0:45 — Teaser + prompt¶
"Next Friday you choose a small Python mini-project. It has to be something you can explain and test yourself."
🤔 Think About This¶
Notice one AI or autocomplete suggestion this week. Did you accept it, change it, or ignore it? Why?
Share-out prompt¶
"Do not just say, 'It worked.' Tell us the test: prediction, action, result."
🔌 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 |
|---|---|---|
| Trusting polished-looking code | no error |
Require a prediction and result before accepting it. |
| AI uses unknown Arcade APIs | NameError: name '...' is not defined |
Replace with patterns students recognize from this unit. |
Missing global score |
UnboundLocalError: cannot access local variable 'score' where it is not associated with a value |
Add global score before changing the variable. |
| Missing colon | SyntaxError: expected ':' |
Read the error and fix one thing. |
| Students want to prompt instead of test | off-task browsing/account issues |
Keep AI teacher-demoed only; students are reviewers today. |
Vocabulary¶
- AI assistant — a tool that can generate suggestions or code from a prompt
- Draft — a first version that must be checked
- Test case — a specific action with an expected result
- Verification — gathering evidence that code does what it should
- Code review — reading code to find problems or improvements
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 26 — Python mini-project