Menu
Coddy logo textTech

Exception vs Error

Lesson 2 of 16 in Coddy's Exception Handling in Python course.

There are two types of errors in Python :

  • Syntax Error (Compile-Time Error)
  • Exception (Run-Time Error)

Syntax Error:

If the code you write doesn't follow python syntax and rules, interpreter will raise 'Syntax Error'.  These errors cannot be handled.

print("Hello World"))

Above program will raise 'SyntaxError' because of unmatched parentheses. You need to fix it for running program successfully.

Exception:

Exception is because of logical errors or any runtime problems or invalid inputs. To avoid sudden termination of program, we can handle it by using Exception Handling concepts.

Try it yourself

This lesson doesn't include a code challenge.

All lessons in Exception Handling in Python