create user-defined exception derived from super class exception class myerror(exception)constructor or initializer def __init__(selfvalue)self value value __str__ is to print(the value def __str__(self)return(repr(self value)tryraise(myerror("some error data")value of exception is stored in error except myerror as argumentprint('this is the argument\ 'argumentoutput'this is the argument 'some error data user-defined exceptions creating user-defined exception programmers may name their own exceptions by creating new exception class exceptions need to be derived from the exception classeither directly or indirectly although not mandatorymost of the exceptions are named as names that end in "errorsimilar to naming of the standard exceptions in python for examplea python program to create user-defined exception class myerror is derived from super class exception class myerror(exception)constructor or initializer def __init__(selfvalue)