Debugging with Karel - Student Handout
π€ WARM-UP: Question of the Day
"How are Python error messages like a GPS when you get lost?"
My thoughts:
Partner's idea:
π ACTIVITY 1: Error Types & Gestures
Learn the 5 Python Error Types:
| Error Type |
Gesture |
What It Means |
| 1. Syntax Error |
π Clap |
Code is "broken" - missing symbols, wrong punctuation |
| Notes: |
| 2. Indentation Error |
βοΈ Step left/right |
Code is "misaligned" - wrong spacing at start of line |
| Notes: |
| 3. Name Error |
π€· Point & shrug |
"Who's that?" - misspelled or undefined name |
| Notes: |
| 4. Index Error |
π Reach too far |
"Out of bounds" - accessing something that doesn't exist |
| Notes: |
| 5. Logic Error |
π Turn in circle |
"Going in circles" - code runs but does wrong thing |
| Notes: |
π¦ BUG SQUAD CHALLENGE - Team Scorecard
Track your team's points during the movement challenge!
R1: ___ R2: ___ R3: ___ R4: ___ R5: ___ R6: ___ R7: ___ R8: ___ R9: ___ R10: ___
TOTAL POINTS: _______ / 10
π₯ ACTIVITY 2: Video Notes
Video: "Debugging with Error Messages" (CodeHS 1.14)
Key Ideas from the Video:
Most Important Thing I Learned:
π₯ ACTIVITY 3: Partnership Debugging Practice
Partner Name:
My Role: Code Reader Error Detective
CodeHS Exercise 1.14.3: Debug - The Two Towers
Errors we found and how we fixed them:
π§ PARTNER DEBUGGING HANDOUT
Work with your partner to find and fix these buggy Karel codes!
Problem 1:
move(
turn_left()
move()
Error Type:
What's wrong?
Fixed Code:
Problem 2:
def build_tower():
move()
put_ball()
move()
Error Type:
What's wrong?
Fixed Code:
Problem 3:
for i in range(5):
move()
put_ball()
turn_left()
Error Type:
What's wrong?
Fixed Code:
π» ACTIVITY 4: Independent Practice
CodeHS Exercise 1.14.7: Debug - Big Tower
Errors I found and how I fixed them:
My Debugging Strategy:
1. Read the error message carefully
2. Identify the error type
3. Locate the line number
4. Recall the gesture to remember the fix
5. Correct and test the code
π« EXIT TICKET: Debug - Random Hurdles
Complete on paper OR complete CodeHS Exercise 1.14.8 if time permits
Debug the code below. Karel should move forward, place a ball, and turn left.
def main():
move()
put_bal()
turn_left(
1. What error type(s) are in this code?
2. Explain what is wrong with the code:
3. Write the CORRECTED code below:
4. BONUS: Which gesture(s) would help you remember this fix?
π REFLECTION
What debugging strategy helped you most today?
On a scale of 1-5, how confident do you feel debugging Python errors?
β 1 (Not confident) β 2 β 3 β 4 β 5 (Very confident)