The try and except keywords allow you to catch exceptions generated by runtime errors in your code, and take appropriate action to remedy the errors and/or alert the user. In this video I introduce the syntax and show you, as an example, how to prevent a possible division by zero from crashing your code.
Embedded video, part of the online courses listed below. For the full context, code and links to more videos, see the repositories linked here:
Computer Programming at Queen Mary, University of London
https://github.com/fsmeraldi/cp-excep...
Coding for Scientists at Queen Mary, University of London
https://github.com/fsmeraldi/c4s-exce...