CS1302 Introduction to computer programming
When will the exception occur?
DevisioinByZeroError
IndexError
It is tedious and time-consuming to debug if the structure of the program is perplexing
An exception is a special object that the program can create when it encounters an extraordinary situation, usually some sort of run-time error.
Common exceptional situations:
Attempting to read past the end of a file
Convert a non-numeric string to a number
A sequence(list,tuple) Index is out of range
First: look before you leap
Second: easier to ask for forgiveness than permission
LPYL
EAFP
Why do we need the finally block?
Execution flow of the try/except statement
Handling mulitiple exceptions
Why we need to handle mutliple excpetions?
Meaning of creating your own excpeiton?
Is the use of exception necessary?
By Chung Chan