sscasc@tumkur infile open("motivation txt"" "open file for input infile open("motivation txt"" "print("\ ( using readlines()"print(infile readlines()#prints lines to list infile close(close the input file main(call the main functionample:read_file py exception handling exception handling enables program to deal with exceptions and continue its normal execution the run-time exceptions immediately terminate running program rather than terminating the program' executionan executing program can detect the problem when it arises and possibly execute code to correct the issue or soften it in some way this explores handling exceptions in python an error that occurs at runtime is also called an exception the run-time exceptions immediately terminate running program python provides standard mechanism called exception handling that allows the program to catch the error and prompt the user to correct the issue or soften it in some way this can be done using python' exception handling syntax the syntax for exception handling is to wrap the code that might raise (or throwan exception in try clauseas followstryexcept herecontains the code that may raise an exception when an exception occursthe rest of the code in is skipped if the exception matches an exception typethe corresponding handler is executed is the code that processes the exception exampledef divide( , )tryc / return except print ("error in divide function"print(divide( , ))#function call output error in divide function none sp_python programming