Vidyalelo
Python · Q49

Classes and Objects in Python

Programming · Python · question 49

Q49

What will be the output of the following Python code? class change: def __init__(self, x, y, z): self.a = x + y + z x = change(1,2,3) y = getattr(x, 'a') setattr(x, 'a', y+1) print(x.a)

A.
6
B.
7
Answer
C.
Error
D.
0

Answer: Option B

Solution

Answer: Option B
No explanation is given for this question Let's Discuss on Board