Reference no: EM132288474
Complete the Error, SyntaxError, and ZeroDivisionError classes such that they create the correct messages when called.
- The SyntaxError and ZeroDivisionError classes inherit from the Error class and add functionality that is unique to those particular errors. Their code is partially implemented for you.
- The add_code method adds a new helpful message to your error, while the write method should print the output that you see when an error is raised.
- You can access the parent class methods using the super() function
class Error:
"""
>>> err1 = Error(12, "error.py")
>>> err1.write()
'error.py:12'
"""
def __init__(self, line, file):
"*** YOUR CODE HERE ***"
def write(self):
return self.file + ':' + str(self.line)
class SyntaxError(Error):
"""
>>> err1 = SyntaxError(17, "HW10.py")
>>> err1.write()
HW10.py:17 SyntaxError : Invalid syntax
>>> err1.add_code(4, "EOL while scanning string literal")
>>> err2 = SyntaxError(18, "HW10.py", 4)
>>> err2.write()
HW10.py:18 SyntaxError : EOL while scanning string literal
"""
type = 'SyntaxError'
msgs = {0 : "Invalid syntax", 1: "Unmatched parentheses", 2: "Incorrect indentation", 3: "missing colon"}
def __init__(self, line, file, code=0):
"*** YOUR CODE HERE ***"
def write(self):
end = self.type + ' : ' + self.message
"*** YOUR CODE HERE ***"
def add_code(self, code, msg):
"*** YOUR CODE HERE ***"
class ZeroDivisionError(Error):
"""
>>> err1 = ZeroDivisionError(273, "HW10.py")
>>> err1.write()
HW10.py:273 ZeroDivisionError : division by zero
"""
type = 'ZeroDivisionError'
def __init__(self, line, file, message='division by zero'):
"*** YOUR CODE HERE ***"
def write(self):
end = self.type + ' : ' + self.message
"*** YOUR CODE HERE ***"
Difficulties in troubleshooting dns errors
: The difficulties in troubleshooting DNS errors. so how do i fix this difficulties in troubleshooting DNS errors.
|
Discuss the five processes of project management
: Discuss the five (5) processes of project management. As a manager, how would you plan, track, and manage projects, and what software could you use?
|
Why is it important to sign saml assertions
: Why is it important to sign SAML Assertions? Why is it not important to sign OAuth Access Tokens?
|
Provide an example of a project selection form
: Explain project management terms, tools, and techniques that are applicable to the pre-planning/project selection stage.
|
Error class and add functionality
: Complete the Error, SyntaxError, and ZeroDivisionError classes such that they create the correct messages when called.
|
Structured format and numbering in listing requirements
: Document a complete list of functional requirements (non-functional requirements are not required). Be specific and describe your requirements
|
Can we have different conceptual schema designs
: Can we have different conceptual schema designs (i.e., ERDs) for the same application?
|
How involvement of minors makes issue more problematic
: Conduct a scholarly literature search of your issue to find a minimum of three references in addition to the Learning Resource you have selected in order.
|
Find out the equation of motion of the cylinder
: 301021 Advanced Thermal and Fluid Engineering Assignment - Project, Western Sydney University, Australia. Find out the equation of motion of the cylinder
|