/curriculum/activities/livecode-syntax-errors/
See if you can fix all of the syntax errors to reveal the mystery melody!

Lesson Plan

Syntax Errors and Mystery Melody

See if you can fix all of the syntax errors to reveal the mystery melody!

Level

Beginner

Time

20 minutes
Try It

What is a syntax error and how do I fix it?

When you make a mistake writing code, you might get a syntax error. That means that Python can't understand what you typed. These error messages can be confusing, but they also give you hints about how to fix mistakes. Here's a quick example where Python is confused because we wrote playnote (with a lowercase “n”) instead of playNote (with an uppercase “N”) on line number 3.

playNote(4, beats = 1) playNote(4, beats = 0.5) playnote(4, beats = 1)

And, here's what the resulting error message looks like.

NameError
the name 'playnote' is not defined on line 3.

To fix this error, pay attention to the line number provided in the error message. Remember that Python wants you to type everything exactly the same way. Python gets confused even by small mistakes.

Try It

See if you can fix all of the syntax errors in this project to reveal the mystery melody.

https://tunepad.com/project/29138

Make sure to hit the REMIX button so that your changes are saved.