Site icon i2tutorials

Python – Sytax errors

Syntax errors in Python

Syntax errors are also called as parser errors are the most common errors. They arise when the python parser is unable to understand a line of code in the program. These errors are almost fatal which means there is no way to successfully execute the program if the program contains syntax errors.

The error is displayed at the piece of line with a little arrow pointing at the earliest point in the line where the error is detected. The error is least detected at the token preceding the arrow. Output displayed is the file name and line number of the code where the error is present. So that, it is easy to detect the error in the respective program.

Whereas, IDLE highlights the syntax error in the program. Almost all the syntax errors are caused due to typos, incorrect or unmatched indentations, incorrect arguments.

In order to avoid some common syntax errors in python, there are some ways to follow. They are:

Exit mobile version