What is the output of the following code? class A: def __init__(self, x , y): self.x = x self.y = y @property def z(self): return self.x + self.y a = A(10, 15) b = A('Hello', '!!!') print(a.z) print(b.z)

Questions & AnswersCategory: Programming LanguageWhat is the output of the following code? class A: def __init__(self, x , y): self.x = x self.y = y @property def z(self): return self.x + self.y a = A(10, 15) b = A('Hello', '!!!') print(a.z) print(b.z)
Adam asked 3 years ago

What is the output of the following code?

class A:

    def __init__(self, x , y):

        self.x = x

        self.y = y

    @property

    def z(self):

        return self.x + self.y

a = A(10, 15)
b = A('Hello', '!!!')

print(a.z)

print(b.z)

 
a. 25
b. 25
Hello!!!
c. 25
25
d. Error