Question: PYTHON 3.6 Task 3 GradingError The GradingError class extends the notion of an Exception (note the (Exception) part of the class signature line). We're making

PYTHON 3.6

Task 3 GradingError The GradingError class extends the notion of an Exception (note the (Exception) part of the class signature line). We're making our own exception that stores a single string message. class GradingError(Exception):

Define the GradingError class to be a child of Exception class (by putting Exception in the parentheses as shown).

def __init__(self,msg): Constructor. Store msg to an instance variable named msg.

def __str__(self): human-centric representation of GradingError is just self.msg

def __repr__(self): computer-centric representation (that could be pasted back to interactive mode to recreate the object). We'll always use triple single quotes as part of the represented string when including the message. For instance, if self.msg=="bad grade", this method would need to return "GradingError('''bad grade''')"

TESTER: https://paste.ee/p/KXIQj

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!