I. Write a RightTriangle class in Python that meets these specifications:
has an __init__ method that
takes either two parameters(the two non-hypotenuse sides) or three (including the hypotenuse). If only two parameters are sent, the hypotenuse is calculated using the Pythagorean theorem. Either way, set instance variables for the two sides and the hypotenuse, with names that make it clear which is which. Remember to import math.
raises exceptions if any of the parameters are negative or can't be cast to float, or if three parameters are supplied and they are not a valid Pythagorean triple (ie, if it is not true that the a2 + b2 = c2). Test this using the technique involving absolute value, not with the == operator. The exceptions should have informative messages (like "Error: both sides and the hypotenuse must be nonnegative"). The exceptions will be handled with in client code (the code that tries to create RightTriangles).
has an __eq__ method that
returns false if the hypotenuse of the other RightTriangle is not very close to equal to the hypotenuse of this RightTriangle (use the technique involving absolute value)
else, returns true if the two sides of the other triangle are very close to the two sides of this triangle, including if the other triangle's side a is very close to this triangle's side b and vice-versa
else, returns false
has a __str__ method that returns a string like this one:
Right Triangle with side a = 3.0, side b = 4.0, and hypotenuse = 5.0
II. Write client code (does not need to be in a class or even a function) that does the following:
first, asks the user for two nonnegative numeric values for the sides, prints the Exception messages raised by the init method if the input is invalid, and keeps asking until valid input is received and a RightTriangle is returned, keeping a reference to the triangle
then, does the same with three values, asking repeatedly until valid values are received for the sides and hypotenuse of a valid right triangle, keeping a reference to the triangle
shows whether the first triangle is equal to itself, then whether the first triangle is equal to the second one.
Paste your code an the output form a test run in the window.