How to access the decorator height and height.setter in this below code:
class Square:
def __init__(self, w, h):
self.__height = h
self.__width = w
def set_side(self, new_side):
self.__height = new_side
self.__width = new_side
@property
def height(self):
return self.__height
@height.setter
def height(self, new_value):
if new_value >= 0:
self.__height = new_value
else:
raise Exception("Value must be larger than 0")
I tried ,
start = Square(4,5)
print(start.height(7)), but its throwing error