Back to Course

Introduction to Python

0% Complete
0/0 Steps
  1. Python: Basics
    14Topics
    |
    15 Quizzes
  2. Python: Control Flow
    12Topics
    |
    12 Quizzes
  3. Python: Errors
    5Topics
    |
    5 Quizzes
Lesson 3, Topic 2
In Progress

Python: Syntax Errors

Yasin Cakal 21 Oct 2021
Lesson Progress
0% Complete

When we write Python programs, our first line of defense against errors is the interpreter. A SyntaxError indicates that something is wrong with the way your program is written such as; misplaced punctuation, an unexpected command, or a missing parenthesis can all result in a SyntaxError.

An example of a SyntaxError error message is as follows:

The interpreter will inform us of its location (file name and line number) and its best guess as to what went wrong.

We can deduce from the error message that the cause of this error is a lack of quotation marks around Hello world!.

Several common syntax errors include the following:

%d bloggers like this: