Home /
Expert Answers /
Computer Science /
complete-the-rectangle-class-and-the-main-rectangle-function-so-that-the-tests-work-as-expected-comp-pa930

Complete the rectangle class and the main_rectangle function so that the tests work as expected

Complete the Rectangle class and the function so that the tests work as expected. class Rectangle: def _init_(self,sides, mid_point): self.sides = sides \# lengths of sides self.mid_point = mid_point \# mid-point (centre) coordinates def perimeter (self): \# complete as needed def area(self): return self.sides [0]*self. sides [1] def dist(self): \# complete as needed def main_rectangle $(x,y)$ : $r=$ Rectangle $(x,y)$ print ('The area $=%$ ' $%r$. area ()$)$ \# complete as needed Example usage: >> main_rectangle $((1,2),(3,4))$ output: The perimeter $=6$ The area $=2$ The distance of mid-point from the origin $=5.00$ $>>$ main_rectangle $((1,2),(3,4))$ output: The perimeter $=6$ The area $=2$ The distance of mid-point from the origin $=5.00$

THE CODE SNIPPET IS GIVEN BELOW:-