Debuggng Day 2 Lesson
 
Debugging Strategies Day 2

🐛 Debugging Strategies: Day 2

Master the Art of Finding and Fixing Code Errors

❓ Question of the Day: What are the steps to effectively debug errors in your code?

🎯 Today's Learning Objective

Students will evaluate error messages to systematically resolve syntax and logic errors in Python code.

📊 Your Progress Today (7 Activities)

1
Video #1
2
Check #1
3
Class Debug
4
Video #2
5
Check #2
6
Partner Debug
7
Independent
📺

Activity #1: Learn Debugging Basics

Video #1 - Introduction to Error Messages

⏱️ 3-5 min

What You'll Learn: Understanding what error messages are and why they're helpful in fixing your code.

💡 Pro Tip: Take notes while watching! Write down key points about reading error messages.

✅ Video Checklist:

Activity #2: Quick Check #1

Check for Understanding - Error Message Basics

⏱️ 3 min

Quick Quiz: Show what you learned from Video #1 about error messages.

✨ You Got This! This is just a quick check to see if you understand the basics before we start debugging.

✅ Success Steps:

👥

Activity #3: Collaborative Debugging

Debugging 1.14.4 - Debug: Lots of Hurdles (Whole Class)

⏱️ 12-15 min

Mission: Work together as a class to find and fix all the errors in the "Lots of Hurdles" program!

🎯 Your Role: Participate actively! Share your ideas about what might be wrong when you see error messages.

The Problem:

Karel needs to jump over hurdles, but the code has errors. Let's fix them together!

📝 Starter Code:

def jump_hurdle():
    turn_left()
    move()
    turn_right()
    move()
    turn_right()
    move()
    turn_left()

for i in range(5):
    move()
    move()
    jump_hurdle()

✅ Participation Checklist:

📺

Activity #4: Advanced Debugging Strategies

Video #2 - Systematic Debugging Techniques

⏱️ 4-6 min

What You'll Learn: Step-by-step strategies for systematically debugging complex code with multiple errors.

💡 Pro Tip: Pay attention to the debugging process, not just the fixes. The METHOD matters!

✅ Video Checklist:

Activity #5: Quick Check #2

Check for Understanding - Debugging Strategies

⏱️ 3 min

Quick Assessment: Demonstrate your understanding of systematic debugging strategies from Video #2.

✨ Show What You Know! Apply what you learned about the debugging process.

✅ Success Steps:

🤝

Activity #6: Partnership Debugging

Debugging 1.14.7 - Debug: Big Tower (Work with a Partner)

⏱️ 12-15 min

Team Up! Partner with a classmate to debug the "Big Tower" program together.

🤝 Partnership Rules:
  • Both partners must contribute ideas
  • Discuss what each error message means
  • Take turns typing fixes
  • Explain your thinking to each other

The Problem:

Karel needs to build a tower from the starting position all the way to the top, but the code has several errors!

📝 Starter Code:

# This program draws a big tower from Karel's starting spot

# This function has karel face north, no matter what direction
# karel starts facing.
def turn_north():
    while facing_north():
        turn_left()

# This function builds a tower all the way to the top of the world.
def build_tower():
    while front_is_clear():
        put_ball()
        move()
        put_ball()

turn_north()
buildtower()
💡 Debugging Hints:
  • Check for syntax errors first (colons, indentation, spelling)
  • Then check for logic errors (wrong conditions, wrong function names)
  • Read error messages completely before making changes

✅ Partnership Checklist:

🎯

Activity #7: Independent Practice & Closure

Debugging 1.14.8 - Debug: Random Hurdles (Work Independently)

⏱️ 10-12 min

Show Your Skills! This is your chance to demonstrate everything you've learned today. Work independently to debug the "Random Hurdles" program.

⚠️ REQUIRED SUBMISSION: You MUST complete the digital debugging worksheet documenting ALL errors from today's three debugging activities (Lots of Hurdles, Big Tower, and Random Hurdles).

The Challenge:

Karel needs to move across a world of 14 columns, either moving forward if clear or jumping hurdles if blocked. The code has several errors - can you find and fix them all?

Note: This does not use Super Karel commands.

📝 Starter Code:

# This function has karel move across a world of 14 columns, moving if the
# front is clear, or jumping a hurdle if it is blocked.

# This function has karel jump a hurdle and end up on the other side.
# Precondition: Karel is facing east in front of a hurdle (one wall high)
# Postcondition: Karel is facing east on the other side of the hurdle
def jump_hurdle():
    turn_left()
    move()
    turn_right():
        move()
        turn_right()
    move()
    turn_left()

for i in range(14):
    if front_is_blocked():
        jump_hurdle()
    else front_is_clear():
    move()
🔍 What to Look For:
  • Syntax errors (colons, indentation)
  • Missing function definitions
  • Incorrect loop ranges
  • Logic errors in conditional statements

✅ Independent Work Checklist:

Finished Early? Extra Time Activities

Catch Up on Incomplete CodeHS.com Assignments

⏱️ Remaining Time

Great Job Finishing Early! If you have completed all 7 activities and submitted your debugging worksheet, use the remaining class time productively.

✨ Make the Most of Your Time! This is a perfect opportunity to catch up on any incomplete CodeHS.com assignments and improve your grade.

What to Do:

  1. Check Your Progress: Log into CodeHS.com and review your assignment list
  2. Identify Incomplete Work: Look for any assignments marked as incomplete or with low scores
  3. Work on Missing Assignments: Complete any exercises, problems, or quizzes you haven't finished
  4. Improve Previous Work: Revisit assignments where you can improve your score
  5. Ask Questions: If you need help, raise your hand or use the help system
💡 Priority Order:
  1. Complete any missing assignments (0% complete)
  2. Finish partially completed assignments
  3. Review and improve assignments with low scores
  4. Get ahead on upcoming assignments

✅ Extra Time Checklist:

📝 Digital Debugging Worksheet

REQUIRED: Document all errors from today's three debugging problems.

⚠️ Remember to Submit! This worksheet is your closure assignment and must be completed before working on other CodeHS assignments.

For Each Program (Lots of Hurdles, Big Tower, Random Hurdles):

Error # Line # Error Message What Was Wrong How You Fixed It
1
2
3

🤔 Final Reflection

Answer the Question of the Day:

What are the steps to effectively debug errors in your code?

Last updated  2025/10/08 00:48:18 PDTHits  56