Syntax Error :

caused by the wrong syntax in the code. It leads to the termination of the program.

val = 10

if(val > 20) #:
  print("Example")

# SyntaxError: invalid syntax

Exceptions :

balance = 10000 
rem = balance / 0 
print(rem)

# ZeroDivisionError: division by zero

Exceptions in Python

# ZeroDivisionError: This occurs when a number is divided by zero.
# NameError: It occurs when a name is not found. It may be local or global.
# IndentationError: It occurs when incorrect indentation is given.
# IOError: It occurs when an Input-Output operation fails.
# EOFError: It occurs when the end of the file is reached, and yet operations are being performed.

Catching Exceptions