Introduction & Overview

Welcome back! Today, we're exploring SyntaxErrors, which are mistakes in our code's structure. By the end of this lesson, you'll be one step closer to writing error-free Python code.

Defining Syntax Errors

Think of syntax as the rules governing the creation of a Python "story". Just like capitalizing the first letter of a sentence or ending it with the correct punctuation are protocols in English, Python follows a certain set of rules. When we don't adhere to these rules, we encroach upon syntax errors.

Examples of Common Syntax Errors

Below are some examples of common syntax errors:

  • Forgetting a colon at the end of a line:
  • Incorrect indentation:
  • Leaving parentheses or brackets unclosed:
  • Misusing Python keywords (A keyword in Python is a reserved word that has a special meaning and purpose (e.g., "for", "while", "if", "else", "def", "import", etc.):
Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal