Python Error Messages Quiz

  • Questions: 15
  • Easy
  • Pass mark: 70%

Every Python programmer sees error messages, and the last line of one usually says exactly what went wrong: the kind of error and a short description. This free quiz has 15 short questions built on the topics of the earlier quizzes, from variables and strings to lists, dictionaries and functions. For each piece of code you decide which error it raises, read the message, or choose the fix.

What the quiz covers

  • NameError and IndentationError: typos, missing quotes and lines indented in the wrong place
  • TypeError: missing arguments and operations that do not fit the type of a value
  • ValueError: a value of the right type that still cannot be used, such as an item that is not in a list
  • IndexError and KeyError: positions and keys that do not exist
  • ZeroDivisionError, and reading an error message to find the fix

How it works

  • 15 questions: 11 with one correct answer, 4 where you select every correct answer
  • After each question you see the correct answer and a short explanation
  • No time limit and no account needed
  • Score 70% or more (11 of 15) to pass

Most of these errors come from topics you can revisit in runnable examples: list indexing, modifying dictionaries, type conversion and functions with parameters. To review whole topics, try the Python Lists Quiz or the Python Dictionaries Quiz.