Complete the code to define a new exception class named MyError that inherits from Exception.
class MyError([1]): pass
The new exception class should inherit from Exception to behave like a standard error.
Complete the code to raise the custom exception MyError with the message 'Oops!'.
raise [1]('Oops!')
To raise the custom exception, use its class name MyError.
Fix the error in the custom exception class by correctly calling the base class constructor.
class MyError(Exception): def __init__(self, message): [1](message)
self.__init__ causes infinite recursion.init without context.Use super().__init__(message) to properly call the base class constructor.
Fill both blanks to add a custom attribute code to the exception and initialize it.
class MyError(Exception): def __init__(self, message, [1]): super().__init__(message) self.[2] = code
The constructor takes code as a parameter and assigns it to self.code.
Fill all three blanks to create a dictionary comprehension that maps error codes to messages for errors with code greater than 100.
errors = {
[1]: [2] for [3] in error_list if [3].code > 100
}The comprehension uses error as the loop variable, maps error.code to error.message for codes above 100.