Python Error Codes: Quick Review
 
Error Detective Answer Reveal

🔍 Error Detective Answer Reveal

Question 1 of 5
Questions Revealed: 0/5
🐛 Question 1: What's wrong with Karel's code?
move() turn_left() move( turn_left()
👏
SYNTAX ERROR!
Missing closing parenthesis on line 3! The move( function call is not properly closed. Just like leaving a door open, Python can't continue until we close it.
✅ FIXED CODE: move() turn_left() move() ← Added closing parenthesis turn_left()
🐛 Question 2: Why won't Karel follow directions?
if front_is_clear(): move() turn_left()
↔️
INDENTATION ERROR!
The commands after the if statement must be indented (moved to the right) to show they belong inside the if block. Think of it like organizing your room - related things go together!
✅ FIXED CODE: if front_is_clear(): move() ← Added 4 spaces turn_left() ← Added 4 spaces
🐛 Question 3: Karel doesn't recognize this command!
karel_move() turn_left() karel_move()
🤷
NAME ERROR!
Python doesn't know what "karel_move()" means! In Karel, the correct function name is just "move()". It's like calling someone by the wrong name - they won't respond!
✅ FIXED CODE: move() ← Correct function name turn_left() move() ← Correct function name
🐛 Question 4: Karel is calling a function that doesn't exist!
move() turn_right() move() drop_ball()
🤷
NAME ERROR!
Python doesn't know what "turn_right()" means! Karel only knows turn_left(). Also, the correct function is put_ball(), not drop_ball(). It's like using commands that aren't in Karel's vocabulary!
✅ FIXED CODE: move() turn_left() ← Correct function name move() put_ball() ← Correct function name
🐛 Question 5: Something's missing in Karel's loop!
for i in range(4: move() turn_left()
👏
SYNTAX ERROR!
Missing closing parenthesis in the range function! The for loop can't start without proper syntax. Every opening parenthesis needs its partner!
✅ FIXED CODE: for i in range(4): ← Added closing parenthesis move() turn_left()
Last updated  2025/10/09 23:15:18 PDTHits  53