Coding · Grade 6
Lists, Tests and Debugging
Learners store many values in Python lists, use zero-based and negative indexes, and loop over lists to total, count and find the largest value. They then test a function by comparing expected and actual results, design edge-case tests that catch hidden buggy versions, and debug using error messages, tracing and temporary prints.
- 4 lessons
- About 85 minutes
- Check what you learned: 8 questions
- Ways to answer: choose an answer, put code in order, trace code, highlight a text, match pairs and type a number
What learners will discover
- Create and change lists using indexes from 0 (and -1 for the last element), len() and append().
- Loop over a list to total values, count matching values and find the largest value.
- Test a function by comparing expected and actual results, choosing normal and edge cases that catch bugs.
- Use error messages, tracing and temporary prints to find and fix bugs.
Lessons
-
Lists and indexes 6 steps3 practiceabout 18 min
-
Looping over lists 6 steps4 practiceabout 20 min
-
Testing: expected versus actual 5 steps2 practiceabout 22 min
-
Reading error messages and debugging 5 steps3 practiceabout 20 min
-
Check what you learned 8 questions at the end
Keep exploring
Games to practice with
- Robot RoutesSnap together arrow, repeat and dance blocks to guide Bolt the robot home.
- Bug DetectiveA robot program almost works. Run it, spot the buggy block, and fix it.
- Sorting FactoryTurn a work order into if/else rules and watch the conveyor sort every item.
More 6th grade coding
- 6th Grade Coding Games5 games to play free
- 6th Grade Coding Worksheets10 printable worksheets
Guide for grown-ups
- How to start homeschooling: a step-by-step guide for familiesA guide for parents · 7 min read