IndexError Exception in Python with Example
belongs to collection: Python Exception Handling Programs
All Answers
total answers (1)
Severity: 8192
Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
Filename: libraries/Filtered_db.php
Line Number: 23
belongs to collection: Python Exception Handling Programs
total answers (1)
Program to illustrate index error in Python
Output:
Explanation:
In the above code, we have created a list consisting of the names of 5 employees of a company. And then prompted the user to enter the id of the employee to be searched. If the ID is out of the range of list, IndexError exception is thrown otherwise the ID is printed.
need an explanation for this answer? contact us directly to get an explanation for this answer