most of the timebeginning programmers simply think of exceptions as fatal runtime errors that cause the end of execution howevermost programming languages provide way to deal with these errors that will allow the programmer to have some type of intervention if they so choose in additionprogrammers can create their own exceptions if they detect situation in the program execution that warrants it when an exception occurswe say that it has been "raised you can "handlethe exception that has been raised by using try statement for exampleconsider the following session that asks the user for an integer and then calls the square root function from the math library if the user enters value that is greater than or equal to the print will show the square root howeverif the user enters negative valuethe square root function will report valueerror exception a_number int(input("please enter an integer ")please enter an integer - print(math sqrt(a_number)traceback (most recent call last)file ""line in print(math sqrt(a_number)valueerrormath domain error we can handle this exception by calling the print function from within try block corresponding except block "catchesthe exception and prints message back to the user in the event that an exception occurs for exampletryprint(math sqrt(a_number)exceptprint("bad value for square root"print("using absolute value instead"print(math sqrt(abs(a_number))bad value for square root using absolute value instead will catch the fact that an exception is raised by sqrt and will instead print the messages back to the user and use the absolute value to be sure that we are taking the square root of nonnegative number this means that the program will not terminate but instead will continue on to the next statements it is also possible for programmer to cause runtime exception by using the raise statement for exampleinstead of calling the square root function with negative numberwe could have checked the value first and then raised our own exception the code fragment below shows the result of creating new runtimeerror exception note that the program would still terminate but now the exception that caused the termination is something explicitly created by review of basic python