What is the output of the following code ?
class MyClass: def __init__(self): self.__a = 1 obj = MyClass() print(obj.__a)
1
None
"" (Blank)
AttributeError: 'MyClass' object has no attribute '__a'
__a is a pseudoprivate attribute which can not be accessed outside of the class directly.
Although it can be accessed using class name. print(obj._MyClass__a) will print 1
Comment here: