What is the output of the following code ?
class AttrTest: def __init__(self, a, b): self.a = a self.b = b obj = AttrTest(34, 'S') obj.X = 7 print(hasattr(obj, 'X'))
True
False
None
Error
obj.X = 7 creates a new attribute. so hasattr() will return True
Comment here: