KnowledgeBoat Logo
|

Computer Science

"Every syntax error is an exception but every exception cannot be a syntax error." Justify the statement.

Python Exception Handling

31 Likes

Answer

A syntax error is a specific type of exception that is detected when we have not followed the rules of the particular programming language while writing a program. On the other hand, an exception is a Python object that represents any type of error or exceptional condition encountered during program execution. This includes not only syntax errors but also runtime errors and logical errors. Therefore, every syntax error is an exception but every exception cannot be a syntax error.

Answered By

21 Likes


Related Questions