What is the output of the following code ?
class A: def __init__(self, x=6): self.k = x class B(A): def __init__(self, y=9): super().__init__() self.l = y obj = B() print(obj.k, obj.l)
AttributeError
None 9
6 9
6 None
When obj is created super().__init__() sets "k" attribute to value 6.
self.l = y sets "k" attribute value to 9 ans y's default value is 9
So it prints 6 9
Comment here: