Lecture Note
University
American Baptist CollegeCourse
CSCI 1534 | Data Analysis and VisualizationPages
2
Academic year
2023
Muthia Marhamah
Views
0
Troubleshooting : Error Class Runtime Error A runtime error in a program is an error that occurs while the program is running after being successfully compiled. Runtime errors are commonly called referred to as “bugs” and are often found during the debugging process before the software is released. Some example of Python runtime errors: Division by zero Performing an operation on incompatible types Using an identifier which has not been defined Accessing a list element, dictionary value or object attribute which doesn’t exists Trying to access a file which doesn’t exist For example: When we run this code, we will get error like this. Handle Exception The try block lets you test a block of code for errors. The except block lets you handle the error. The else block lets you execute code when there is no error. The finally block lets you execute code, regardless of the result of the try and except blocks
Using Except: Using Else Using Finally Using Raise Exception
Runtime Errors and Handle Exception
Please or to post comments