What is the output of the following code? class A: def __init__(self, val): self.x = val @property def x(self): return self.__x @x.setter def x(self, val): self.__x = val @x.deleter def x(self): del self.__x a = A(7) del a.x print(a.x)

Questions & AnswersCategory: Programming LanguageWhat is the output of the following code? class A: def __init__(self, val): self.x = val @property def x(self): return self.__x @x.setter def x(self, val): self.__x = val @x.deleter def x(self): del self.__x a = A(7) del a.x print(a.x)
Adam asked 3 years ago

What is the output of the following code?

class A:

    def __init__(self, val):

        self.x = val

    @property

    def x(self):

        return self.__x

    @x.setter

    def x(self, val):

        self.__x = val

    @x.deleter

    def x(self):

        del self.__x

a = A(7)

del a.x

print(a.x)

 
a. TypeError
b. 7
c. AttributeError
d. ValueError