If you are facing any issue in playing video please use Firefox browser.
Exception Handling in Python 2
In this lecture we will see that,
How to perform exception handling in Python ?
How to raise the exception ?
print('You cannot enter string')
You cannot enter string
Similarly we can use all the error blocks in one code and it will execute one error block according to the action.
Try .....finally clause
Finally clauses are called clean-up or termination classes, because they must be executed under all circumstances, ie. a "finally" clause is always executed regardless if an exception occurred in a try block or not.
To explicitly raise exception at that time we can use raise.
raise Exception("Something happened in my program")
raise Exception ("c has to be less than 5")
Exception : c has to be less than 5
Have a friend to whom you would want to share this course?