“Every syntax error is an exception but every exception cannot be a syntax error.” Justify the statement.
Open in App
Solution
Syntax error is an exception because python interpreter is unable to understand the statement you have written. Usually occurs when you have not followed the correct syntax of writing a statement. Even if a statement or expression is syntactically
correct, there might arise an error during its execution.
For example, trying to open a file that does not exist,
division by zero and so on. Such types of errors might
disrupt the normal execution of the program and are
called exceptions.