Tell us what’s happening:
Everything is working fine, all the test pass, but just because I’ve wrote this line like this:
def str(self):
return f"Square(side={self.width})"
The thing is that there’s a test where they change the attribute width of the square instance:
As you can see, they do a sq.set_width(4), which is a method inherited from Rectangle. The problem is that when you change the width or the height through inherited methods, then you have a square instance with different width and height. Then, if you change the code from before to:
def str(self):
return f"Square(side={self.height})"
Then the test fails because the return should be Square(side=4) and instead it’s Square(side=2).
So, I would like to know if anyone knows if there’s a way to make it work so if you change an inherited attribute through inherited methods, both attributes get changed and the test doesn’t fail.
I hope I’ve made myself understood and thanks in advance!
Your code so far
https://repl.it/@axelsolsona/fcc-shape-calculator#shape_calculator.py
Challenge: Polygon Area Calculator
Link to the challenge: