built-in exceptions in this examplethe default __init__(of exception has been overridden the new behaviour simply creates the value attribute this replaces the default behaviour of creating the args attribute in tryblock exception is raised explicitly by using raise keyword the exception is caught by except block exampledefine python user-defined exceptions class error(exception)pass class valuetoosmallerror(error)pass class valuetoolargeerror(error)pass number while truetryi_num int(input("enter number")if i_num numberraise valuetoosmallerror elif i_num numberraise valuetoolargeerror break except valuetoosmallerrorprint("this value is too smalltry again!"print(except valuetoolargeerrorprint("this value is too largetry again!"print(print("congratulationsyou guessed it correctly "outputenter number this value is too largetry againenter number this value is too smalltry againenter number congratulationsyou guessed it correctly page