Question OOP-CLS-0063
HardWhat is the output of this code?
class P:
__slots__ = ("x",)
def __init__(self):
self.x = 1
p = P()
try:
p.y = 2
print("ok")
except AttributeError:
print("blocked", p.x)
- A.
blocked 1
- B.
blocked 2
- C.
ok
- D.
AttributeError
Sign up free to see the answer and a step-by-step explanation.