Jan-20-2019, 02:20 PM
Hello everyone,
I've got problem with assertion. It seems that it should work, but after running the program I receive AssertionError. Do you have any idea why and how I can fix it/modify declaration of classes?
This is my code:
and the error:
I've got problem with assertion. It seems that it should work, but after running the program I receive AssertionError. Do you have any idea why and how I can fix it/modify declaration of classes?

This is my code:
class Figure1: def __init__(self, x, y, z): self._x = x self._y = y self._z = z @property def area(self): return (self._x + self._y) * self._z / 2 class Figure2(Figure1): def __init__(self, x, z): super().__init__(x=x, y=x, z=z) class Figure3(Figure2): @property def circumference(self): return self._x * 4 class Figure4(Figure2): def __init__(self, x, y): super().__init__(x=x,z=y) @property def circumference(self): return 2 * self._x + 2 * self._z class Figure5(Figure4, Figure3): def __init__(self, x): super().__init__(x=x, y=x) a = Figure5(9).area print(a) b = Figure5(9).circumference print(b) if __name__ == "__main__": Figure5.x = 9 assert Figure5.circumference == 36 assert Figure5.area == 81
and the error:
Error:81.0
Traceback (most recent call last):
36
line 37, in <module>
assert Figure5.circumference == 36
AssertionError
Process finished with exit code 1