Home /
Expert Answers /
Computer Science /
python-question-4a-create-an-exception-class-invaliddeptherror-define-a-str-dunder-method-for-thi-pa175
(Solved): Python Question 4a. Create an exception class InvalidDepthError. Define a str dunder method for thi ...
Python
Question 4a. Create an exception class InvalidDepthError. Define a str dunder method for this class to return a string \"Invalid Depth\". Question 4b. Define a class that meets the following specifications. Question 4c. Define a class method for the WaterBody class that meets the following specifications. Question 4d. Define a instance method for the WaterBody class that meets the following specifications.\r\nQuestion 4e. Define three static methods for the WaterBody class that meet the following specifications. Question 4f. Define a class method for the WaterBody class that meets the following specifications. You can use the following lines of code to verify part of your code. pool = WaterBody(10) print(pool.get_hydrostatic_pressure(1)) \\# prints 9780.57 print(pool.get_water_mass()) \\# prints 9970 try: pool.get_hydrostatic_pressure(-1) except Exception as e: \\( \\quad \\) print(e) \\# prints Invalid Depth pool = WaterBody(10) print(pool.get hydrostatic_pressure(1)) \\# prints 9780.57 print(pool.get_water_mass()) \\# prints 9970 try: pool.get_hydrostatic_pressure (-1) except Exception as e: print(e) \\# prints Invalid Depth