1. Knowledge Base
  2. Teaching with Kira

Code Debugging: Understanding Error Messages

Your quick resource for debugging code on the fly.

What to do when you get an error

First, we should start off by saying that errors are beautiful. At Kira, we believe that errors, mistakes, and failures are some of the best ways for you and your students to learn - if mistakes weren't being made, it would mean you know everything already, and then what's the point?

We realize that, as a teacher, it can often be a very vulnerable and intimidating feeling to see things go wrong and not know. In the CS space, that's okay! No one is supposed to know everything, not even the best of the best software engineers. When confronted with an error, we recommend:

  1. Take a deep breath - no error message is going to make the computer explode or break the internet. Staying calm also helps normalize for your students that bugs, errors, and mistakes don't have to be scary, they can just be a part of our learning!
  2. Look for clues - that error message in the console probably is telling you something helpful. Does it give you any hints or line numbers to look at?
  3. Learn the error message - not sure what an error message means? Continue down in this article for a quick rundown of common errors - but you can also pop Python questions into Google! Python is used by developers around the world and there are a lot of resources available.
  4. Model debugging - it's okay to tell your students "I'm not sure why that's happening, but let's figure it out together." They'll appreciate the transparency and support, and it will show them how to react to future errors.

Common Mistakes: Platypus Problems

If you think you solved a Platypus problem perfectly and your answer isn't being accepted, take a peek at these common errors. Remember, Platypus runs on Python - so the syntax errors in the next section could also help you decipher what may be going wrong!

Platypus Orientation Matters: your Platypus needs to match the Platypus in the 'Your Task' image exactly, including facing in the same direction.

Is there something under there?: sometimes, the last square a Platypus lands on may include an object that has been put down but is difficult to see. If you think you nailed the orientation and it's still not right, look closely at what could be hiding.Screenshot 2024-09-06 at 11.25.50 AM

Use the Lesson Skills: if the lesson indicates you should solve with, say, a while loop, and you haven't used one, you may be asked to try again. Be sure to read the directions carefully!

Common Mistakes: Python Syntax Errors

You may run a bit of Python code and suddenly see an error pop up in the console. This can be scary, but the console is trying to be your friend and not only point out where the code is breaking (by telling you a line number) but what the reason was for the break (with an error message).

It can be intimidating to see these, but learning to read and utilize your errors will give you superpowers. Remember: if you're ever unsure even beyond our guide below, you can absolutely Google your problem and probably find useful information!

  • Unexpected EOL --> "end of line," something did not end in a Python-friendly way
    • ...while scanning string literal --> missing a quotation mark around a string
    • ...while parsing --> often a missing parentheses, square bracket, or similar
  • Indentation Error --> something is indented incorrectly
    • ...expected an indented block --> line or lines lack an indent
    • Unindent does not match any outer indentation level --> indentations aren't the same in a code block (ex: using two tabs vs one tab, or 3 spaces vs 2 spaces)
  • Type Error --> you're mixing data types that can't be mixed
    • Can only concatenate str (not "int") to str --> can't add integers and strings
  • Name Error
    • Name ... is not defined --> a variable or function is being used before it is defined. Sometimes a typo is to blame!
  • Invalid Syntax --> you've written something Python doesn't understand (or left out an important piece like a keyword or colon)

Happy Debugging!