HOME C C++ PYTHON JAVA HTML CSS JAVASCRIPT BOOTSTRAP JQUERY REACT PHP SQL AJAX JSON DATA SCIENCE AI

Python Exception Handling


Process of responding to the occurence during computation of exceptional condition requiring special processing ofrtn changing the normal flow of program execution.


Python Exception


An exception is an event which occurs during the execution of a program that disrupts the normal flow of the program's instruction.

Important Terms:


Example
 try:
    numerator = 10
    denominator = 0

    result = numerator/denominator

     print(result)
     except:
     print ("Error: Denominator cannot be 0.")
    
    Output
    Error: Denominator cannot be 0.