There are 2 stages where error may happen in a program
- During compilation -> Syntax Error
- During execution -> Exceptions
Syntax Error
- Something in the program is not written according to the program grammar.
- Error is raised by the interpreter/compiler
- You can solve it by rectifying the program
Python syntax error demonstration with print statement
Explanation
- The code contains a classic Python 2 to Python 3 syntax error where the print statement is missing parentheses
- In Python 3, print must be called as a function with parentheses around its arguments
