exceptionname is the type of exception we want to raise args are the exception arguments and traceback is the traceback object used for the exception following is an example for demonstrating raise keywordtryraise nameerror except nameerrorprint("name error"in the above code nameerror exception is raised by the raise statement and is handled by the except block re-raising exceptions in pythonwe can re-raise the exceptions in the except block by writing raise keyword following code demonstrates re-raising exceptionstryraise nameerror except nameerrorprint("name error"raise output is as followsname error traceback (most recent call last)file "test py"line in raise nameerror nameerror handling exceptions in functions we can use try and except blocks inside functions as we are using until now in the try blockwe can call function if this function raises an exceptionit can be handled by the except block which follows the try block following example demonstrates handling exceptions in functionsdef div(numdenom)return num/denom trydiv( except zerodivisionerrorprint("denominator cannot be zero"output for the above program is as followsdenominator cannot be zero