In this chapter, we talked about errors and exceptions, what they are, and how to avoid them. We looked at a few built-in errors and the scenarios that would cause them to be raised. We then moved on to handling them by using try…except and finally blocks. We also covered how to implement our own custom exceptions by using the Exception base class.
This should give you the ability to make your programs more robust by handling both seen and unforeseen issues that may arise during code execution. Handling errors should also help prevent unpleasant usability or security issues from cropping up when your code is in the wild.
This book is an introduction to the general-purpose language Python. We have covered topics such as variable names; working with functions; modules; data structures such as lists, tuples, and dictionaries; and even working with files. This book is designed to get you from beginner level to intermediate Python developer level. We hope that you have enjoyed this experience...