in Python by
Q:
What is the output of the following code?

class A:

    def __init__(self, value):

        self.x = value

    @property

    def x(self):

        return self.__x

    @x.setter

    def x(self, value):

        if not isinstance(value, (int, float)):

            raise ValueError('Only Int or float is allowed')

        self.__x = value

a = A(7)

a.x = 'George'

print(a.x)

a) George

b) AttributeError

c) 7

d) ValueError

► Click here to show 1 Answer

0 votes
by
d) ValueError
Python
Learn More with Madanswer

Related questions

0 votes
asked Dec 14, 2019 in Python by sharadyadav1986
...