1class HauntedMansion:
2 def __init__(self, **kwargs):
3 for name, value in kwargs.items():
4 setattr(self, name, value)
5 def __setattr__(self, name, value):
6 object.__setattr__(self,"spooky_" + name, value)
7 def __getattr__(self, key):
8 return self.__dict__.get(key, "Booooo, only ghosts here!")
.
----------------------------------------------------------------------
Ran 1 test in 0.000s
OK
02.11.2024 20:55
02.11.2024 20:56