Chapter 36: Problem 2
Exception objects and lists. Change the oops function you just wrote to raise an exception you define yourself, called MyError. Identify your exception with a class (unless you're using Python \(2.5\) or earlier, you must). Then, extend the try statement in the catcher function to catch this exception and its instance in addition to IndexError, and print the instance you catch.
Short Answer
Expert verified
Define `MyError`, raise it in `oops`, and catch it in `catcher` alongside `IndexError`.
Step by step solution
Key Concepts
These are the key concepts you need to understand to accurately answer the question.