denominator int(input()tryquotient numerator denominator print("quotient:"quotientexcept (nameerror,valueerror,zerodivisionerror)print("denominator cannot be zero"for input and the output for the above code isdenominator cannot be zero handle any exception in some caseswe might want to execute the same code (handlerfor any type of exception such common handler can be created using except as followstrystatement(sexceptstatement(sfollowing is an example which demonstrates handling any exception with single except blocknumerator int(input()denominator int(input()tryquotient numerator denominator print("quotient:"quotientexceptprint("denominator cannot be zero"for input and the output for the above code isdenominator cannot be zero else clause the try and except blocks can be followed by an optional else block the code in else block executes only when there is no exception in the try block the else block can be used to execute housekeeping code like code to free the resources that are being used raising exceptions we can raise exceptions manually even though there are no exceptions using the raise keyword syntax of raise statement is as follows