🚨 Error Message

5th Grade 💻 Coding

An error message is a note the computer shows when something in your code is wrong. It tells you what kind of problem it is, which line it happened on, and sometimes what to check.

Free · US Letter · no sign-up
Google Classroom Save to Pinterest Email me

In Python, an error message usually ends with a line like NameError: name 'Print' is not defined. The first part is the type of error, and after it comes a short explanation. Above that, the message shows the line number where the program stopped. Newer versions of Python even give hints, like “Did you mean: print?”

Beginners often panic when they see red text, but error messages are the best clue you can get. Here are the rules: read the whole message slowly, go to the line it points to (and check the line before it too), and if you still don’t understand, look up the error type to learn what it means. The words in error messages repeat a lot, so you’ll learn them fast.

For example

  • ZeroDivisionError: division by zero means you tried to divide a number by 0.
  • Scratch almost never shows error messages. When something doesn’t work there, you have to watch what the sprite does and figure out why.

📌 Remember: An error message is a clue from the computer: what went wrong, where, and sometimes what to do.

Quick quiz

  1. What does an error message show?

  2. What should you do with an error message?

  3. Why should you also check the line before the one in the message?

🔎 Ask Thinkapedia another question