python uses special objects called exceptions to manage errors that arise during program' execution whenever an error occurs that makes python unsure what to do nextit creates an exception object if you write code that handles the exceptionthe program will continue running if you don' handle the exceptionthe program will halt and show tracebackwhich includes report of the exception that was raised exceptions are handled with tryexcept blocks tryexcept block asks python to do somethingbut it also tells python what to do if an exception is raised when you use tryexcept blocksyour programs will continue running even if things start to go wrong instead of tracebackswhich can be confusing for users to readusers will see friendly error messages that you write handling the zerodivisionerror exception let' look at simple error that causes python to raise an exception you probably know that it' impossible to divide number by zerobut let' ask python to do it anywaydivision py print( / of course python can' do thisso we get tracebacktraceback (most recent call last)file "division py"line in print( / zerodivisionerrordivision by zero the error reported at in the tracebackzerodivisionerroris an exception object python creates this kind of object in response to situation where it can' do what we ask it to when this happenspython stops the program and tells us the kind of exception that was raised we can use this information to modify our program we'll tell python what to do when this kind of exception occursthat wayif it happens againwe're prepared using try-except blocks when you think an error may occuryou can write tryexcept block to handle the exception that might be raised you tell python to try running some codeand you tell it what to do if the code results in particular kind of exception here' what tryexcept block for handling the zerodivisionerror exception looks liketryprint( / except zerodivisionerrorprint("you can' divide by zero!"