0 votes
in Python by
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

1 Answer

0 votes
by
d) ValueError

Related questions

0 votes
asked Dec 14, 2019 in Python by sharadyadav1986
0 votes
asked Jan 19, 2021 in Python by SakshiSharma
...