class Pet:
def __init__(self, name, colour):
self.__name = name
self.__colour = colour
@property
def colour(self):
return self.__colour
@colour.setter
def set_colour(self, colour):
if colour == 'grey':
self.__colour = colour
else:
print("Такого кота не існує")
@property
def name(self):
return self.__name
marsik = Pet("Marsik", "grey")
marsik.display_info()
marsik.colour = "blue"
print(marsik.colour)
marsik.colour = "grey"
marsik.display_info()