Create a class, MissingIdError. that represents an exception By specifying the p
ID: 3572836 • Letter: C
Question
Create a class, MissingIdError. that represents an exception By specifying the parent class LookupError as in the example below, objects (values) of this class can be raised, and can be caught only where LookupErrors or MissingldErrors arc caught. class MissingldError (LookupError): Instance variables: id:: int category:: string (should be either "Patron" or "Book") Methods: init (self, id, category = "Book"):: constructor, instantiates all instance variables. str (self):: returns string representation matching this format (based on the category and id): 'Book #12345 not found* 'Patron #2468 not found' repr (self) returns same string representation as str .Explanation / Answer
"""output:
__main__.MissingIdError: 'Patron #124 not found '"""
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.