Question OOP-CTOR-0066
HardWhat is the output of this code?
class A:
def __init__(self):
self.ready = False
self.setup()
def setup(self):
self.ready = True
class B(A):
def __init__(self):
self.extra = []
super().__init__()
def setup(self):
self.extra.append("x")
super().setup()
b = B()
print(b.ready, b.extra)
- A.
True ['x']
- B.
False []
- C.
True []
- D.
AttributeError
Sign up free to see the answer and a step-by-step explanation.