What is the output of the following code ?
class AttrTest: def __init__(self, a, b, c): self.X = a + b + c p = AttrTest(7, 8, 9) b = getattr(p, 'X') setattr(p, 'X', b + 1) print(p.X)
24
25
None
Error
a + b + c will be 7 + 8 + 9 = 24
b = getattr(p, 'X') will be 24 setattr(p, 'X', b + 1) will set X to 24 + 1
Comment here: