Scientific Computing with Python Projects - Polygon Area Calculator

Tell us what’s happening:
I have finished this project and the tests runs without errors but I am not sure about one thing:

Additionally, the set_width and set_height methods on the Square class should set both the width and height.

I should set those methods in Square class like I did or edit it in Rectangle class?

Your code so far

class Square(Rectangle):
    def __init__(self, side):
        super().__init__(side,side)
    
    def __str__(self):
        return "Square(side={})".format(self.width)
    
    def set_side(self, side):
        self.width, self.height = side, side

    def set_height(self, height):
        self.set_side(height)
    
    def set_width(self, width):
        self.set_side(height)

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.81 Safari/537.36

Challenge: Scientific Computing with Python Projects - Polygon Area Calculator

Link to the challenge:

as it’s only for the Square class, you should not edit the Rectangle class

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.