raise raise instance of class raise make and raise instance of class raise reraise the most recent exception exampleval int(input("enter the number ")tryif val == raise ioerror("hello"except ioerrorprint ("an exception is raisedelseprint ("value is not "outputenter the number value is not enter the number an exception is raised if you enter value equal to then if block will raise the exception by using raise keyword the except block will handle that exception user-defined exceptions programs may name their own exceptions by creating new exception class exceptions should typically be derived from the exception classeither directly or indirectly exception classes can be defined which do anything any other class can dobut are usually kept simpleoften only offering number of attributes that allow information about the error to be extracted by handlers for the exception when creating module that can raise several distinct errorsa common practice is to create base class for exceptions defined by that moduleand subclass to create specific exception classes for different error conditions exampleclass myerror(exception)def __init__(selfvalue)self value value tryraise myerror("ohh"except myerrorprint("my exception occurred"outputmy exception occurred page