August 2019
Beginner
482 pages
12h 56m
English
But what are the exceptions? You can think of them as warning messages letting us know about computation issues and halting the computation. For example, when we're trying to divide by zero, the computer knows it's wrong and raises a corresponding ZeroDivisionError type error, stopping the process. We can raise exceptions from within our own code by using the raise keyword. There are a handful of built-in exception types, such as KeyError, ValueError, and IndexError. The only significant difference between these is the name, which helps us to understand and differentiate between issues. All those exceptions inherit from the base exception type—Exception. Each exception can be raised with supporting text if you so desire. Consider ...