class A:
x = 0
def func(obj):
obj.x = 2
return obj
a = A()
a.x = 1
b = func(a)
print(a.x)
Can you explain why the output is 2? I couldn’t figure out whata.x and obj.x signify in this code. (Python)
Expert Answer
An answer will be send to you shortly. . . . .