Exceptions bubble up the call stack until they are handled or the program crashes. This gives you flexibility on where in your code to handle any runtime errors. In this video, I show you how an error originating in a function can be remedied either immediately in the function, or in the code that calls it. Check out the notebooks linked below for more information on Exception Handling in Python.
Embedded video, part of the following courses:
Computer Programming at Queen Mary, University of London
Jupyter notebook: https://tinyurl.com/3u76k8bf
Coding for Scientists at Queen Mary, University of London
Jupyter notebook: https://tinyurl.com/46wv5tpt
Notebooks will open on Google Colab - no installation required