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...
Watch video The try-except clause in Python: handling runtime errors in your code (and preventing crashes) online without registration, duration hours minute second in high quality. This video was added by user PatchyPython 20 October 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 47 once and liked it 1 people.