CISC 121 Lecture Notes - Lecture 8: Global Variable
wunch and 39345 others unlocked
35
CISC 121 Full Course Notes
Verified Note
35 documents
Document Summary
Logic errors: programs work"s but does the wrong thing for example if it says 5+2=9. Python has built in error messages for example zerodivisonerror, ioerror, indexerror, Nameerror, typeerror (raised when an operation of function is applied to an object of the wrong type for example len(7), valueerror (int( dog )) It is possible to override the default behavious (print error information and crash ) when an exception is raised, using try/except statements. If there is an error in this code then it will drop out of the try we put and go to the except: and do whatever we told it to do if it goes to the except. Preferably do a loop through here so that it can not restart every time. We can restrict to type"s of errors so if we only want to catch one type of errors put except. We can have multiple exception handlers so one try and multiple excepts for different types of errors.