mydict {mydict[' 'traceback (most recent call last)file ""line in mydict[' 'keyerror' #above keyerror #below asking for index that didn' exist in list mylist [ , , , mylist[ traceback (most recent call last)file ""line in mylist[ indexerrorlist index out of range #aboveindex out of rangeraised indexerror catching/trapping exception when something unusual occurs in your program and you wish to handle it using the exception mechanismyou 'throw an exceptionthe keywords try and except are used to catch exceptions whenever an error occurs within try blockpython looks for matching except block to handle it if there is oneexecution jumps there syntaxtry#write some code #that might throw some exception except exception handleralert the user the code within the try clause will be executed statement by statement if an exception occursthe rest of the try block will be skipped and the except clause will be executed trysome statement here exceptexception handling