A program defines its own exception class, raises it and catches it. class LowFuel(Exception): def __init__(self, left): super().__init__("fuel", left) self.left = left try: raise LowFuel(3) except Exception as e: print(e.args, e.left, type(e).__name__) What does the program print?
Log in to join the discussion.
Loading…