Python Programming - Tricky Questions - Discussion

Discussion Forum : Tricky Questions - General Questions (Q.No. 10)
10.
Consider the following Python code:
class CustomError(Exception):
    def __init__(self, message):
        super().__init__(message)

raise CustomError("An example custom error.")
What will happen when this code is executed?
The code will run without any errors.
The code will result in a TypeError.
The code will result in a NameError.
The code will raise a custom error of type CustomError.
Answer: Option
Explanation:
The code raises a custom error of type CustomError with the specified message.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.