Question OOP-CLS-0061
HardWhat is the output of this code?
class A:
x = []
def __init__(self, v):
self.x = self.x + [v]
a, b = A(1), A(2)
print(a.x, b.x, A.x)
- A.
[1] [2] [1, 2]
- B.
[1, 2] [1, 2] [1, 2]
- C.
[1] [1, 2] [1, 2]
- D.
[1] [2] []
Sign up free to see the answer and a step-by-step explanation.