×
Menu
Index

5.1 SyntaxError: Invalid Syntax

The most common error a beginner will encounter is a syntax error. Syntax errors can have many different causes but are usually the result of a typo. They are typically very easy for the Python interpreter to find and easy for the user to correct.
 
Code
Error Message
Solution
We need a ‘:’ (colon) at the end of any ‘if’, ‘else’, ‘elif’, ‘for’, ‘while’, ‘class’, or ‘def’ statement
 
 
Code
Error Message
Solution
Used the assignment operator ‘=’ instead of a comparison operator ‘==’