python error & built-in exceptions
People often gets confused with error and exception as both looks very similar but these two operates in a very different way.
Error encounters in the program when something wrong with the code. In error situation, program execution gets terminated and there is no way to handle this case unless you don’t fix the error.
Most common error observed with programmer is – syntax error. Observe this example to understand how error looks like in python.
This example demonstrates syntax error with if statement. You can see, semicolon is missing in if statement.
Python built-in Exceptions
The built-in exceptions are raised by interpreter or built-in functions whenever an extraordinary error situation occur in the code.
When an exception encounter in your code, program execution will get terminated unless you don’t handle specific situation in your code. HOW to handle an exception? Visit this page – Python try/except and finally Statements.
There is also possibility to raise built-in exception manually by using raise keyword. Visit this page to learn more about Python raise keyword.
[table id=1 /]