Solution of a question

class A():
x = 1
a = A()
print(a.x)

b = [A()] * 10
for ix in b:
print (ix.x)

b[2].x = 5
for ix in b:
print (ix.x)
How the problem will be resolved in this case?

Hey @shubham_sinha, here we are replicating the single class objects 10 times and hence the error comes, we need to make 10 differenct objects and than append them in b, like this.

b = []
for ix in range(10):
    b.append(A())

Hope this resolved your doubt.
Plz mark it as resolved in my doubts section. :blush:

Thanks for the solution