Along with traceback errors, syntax errors are a common type of error in Python code. It appears when Python is unable to understand a line of code, meaning that there is a mistake. Often, syntax errors point to typos, indentation, or incomplete expressions, like missing quotation marks or parentheses.
When a syntax error occurs, the interpreter will display a caret pointing to the area where the error occured. It will also display the message: SyntaxError: invalid syntax
. Take a close look at the display message to get more information about your error, and help you with debugging.
-
See a fuller description of syntax errors on Geek University.
-
To see a comprehensive list of possible errors, check out this resource on Tutorials Teacher.