All python exceptions are not runtime errors, some are syntax errors as well.
If you run the given code, you get the following output.
File "C:/Users/TutorialsPoint1/~.py", line 4 else: ^ SyntaxError: invalid syntax
We see that it is syntax error and not a runtime error.
Errors or inaccuracies in a program are often called as bugs. The process of finding and removing errors is called debugging. Errors can be categorized into three major groups:
Python will find these kinds of errors when it tries to parse your program, and exit with an error message without running anything. Syntax errors are like spelling or grammar mistakes in a language like English.
If a program is free of syntax errors, it will be run by the Python interpreter. However, the program may exit if it encounters a runtime error – a problem that went undetected when the program was parsed, but is only revealed when the code is executed.
Some examples of Python Runtime errors −