2-Two Towers Challenge Teacher Answer Key
 
Two Towers Challenge - Teacher Answer Key

🗼 Two Towers Challenge

Quick Teacher Answer Key - CodeHS Exercise 1.14.3

⏱️ 6-Minute Assessment Guide

⚡ Quick Reference: All 3 Errors at a Glance

Error # Line(s) Error Type Problem Fix
1 Line 5 Syntax Error Missing def keyword Add def before come_down():
2 Line 6 Name Error Function not defined Must define turn_around() function
3 Lines 13, 16 Name Error Function misspelled Change buildtower() to build_tower()
1 Missing def Keyword
Syntax Error
❌ The Problem (Line 5):
come_down(): turn_around() move() move() turn_left()

Why it's wrong: Python requires the def keyword to define a function. Without it, Python doesn't recognize this as a function definition.

👏
Gesture: Clap (broken code - missing symbol)
✅ The Fix:
def come_down(): turn_around() move() move() turn_left()

What students should explain: "The function definition is missing the def keyword. Python needs def to know we're creating a function."

2 Undefined Function Called
Name Error
❌ The Problem (Line 6):
def come_down(): turn_around() # ← This function is NOT defined! move() move() turn_left()

Why it's wrong: The turn_around() function is called but never defined in the starter code. Python cannot execute a function that hasn't been defined.

🤷
Gesture: Point & Shrug (Who's that? - undefined name)
✅ The Fix - Students must ADD this function:
def turn_around(): turn_left() turn_left()

⚠️ Teaching Note: This is the trickiest error! Students must realize they need to CREATE a missing function, not just fix existing code.

3 Misspelled Function Name
Name Error
❌ The Problem (Lines 13 AND 16 - appears TWICE!):
move() buildtower() # ← Line 13: Missing underscore! come_down() move() move() buildtower() # ← Line 16: Missing underscore again! move() turn_right()

Why it's wrong: The function is defined as build_tower() (with underscore) but called as buildtower(). Python is case-sensitive and treats these as different names.

🤷
Gesture: Point & Shrug (Who's that? - misspelled name)
✅ The Fix (in TWO places!):
move() build_tower() # ← Added underscore come_down() move() move() build_tower() # ← Added underscore move() turn_right()

⚠️ Common Mistake: Many students will fix line 13 but forget line 16. Remind them: "How many times is build_tower() called?"

✅ Quick Grading Checklist

Full Credit (All errors found):

Partial Credit:

Needs Review:

⏱️ Time Management for 6-Minute Check

  • Minutes 1-2: Quick scan - did they find all 3 error locations?
  • Minutes 3-4: Check error type classification
  • Minute 5: Verify they CREATED turn_around() function
  • Minute 6: Provide quick feedback and stamp/initial

💡 Teaching Tips & Common Mistakes

🎯 For Error #1

  • "What keyword does Python need to define a function?"
  • "What's missing from this line?"
  • Watch for: Students adding def in wrong place

🎯 For Error #2

  • "Does this function exist anywhere in the code?"
  • "What would Karel need to do to turn around?"
  • Watch for: Students marking it but not writing the solution

🎯 For Error #3

  • "How is the function name spelled when it's defined vs. called?"
  • "Are there any other places this function is called?"
  • Watch for: Only fixing one instance

📊 Expected Performance

  • Strong: Finds all 3 errors in 3-4 minutes
  • Developing: Finds 2 errors, needs prompting
  • Needs Support: Finds only Error #3

🌟 Extension for Early Finishers

  1. "Why do you think the turn_around() function is missing?"
  2. "Could you create a turn_right() function a different way?"
  3. "What would happen if you only fixed line 13 but not line 16?"

✨ Complete Solution Code

Total Errors: 3 errors (but Error #3 appears twice, so 4 corrections needed)

def turn_right(): turn_left() turn_left() turn_left() def turn_around(): # ← ERROR #2: This was missing! turn_left() turn_left() def come_down(): # ← ERROR #1: Was missing 'def' turn_around() move() move() turn_left() def build_tower(): turn_left() put_ball() move() put_ball() move() put_ball() move() build_tower() # ← ERROR #3: Was 'buildtower()' come_down() move() move() build_tower() # ← ERROR #3: Was 'buildtower()' move() turn_right()

📝 Summary of All Changes

  • Added: def turn_around(): function (completely missing)
  • Fixed: Added def keyword to come_down(): function
  • Fixed: Changed buildtower() to build_tower() on line 13
  • Fixed: Changed buildtower() to build_tower() on line 16
Last updated  2025/10/20 01:04:47 PDTHits  49