I want to create array of objects in python.
class user:
j = [0, 0]
AllUsers = []
AllUsers.append(user)
AllUsers.append(user)
AllUsers[0].j[0] = 1
for i in AllUsers:
print(i.j)
And I expect output:
[1, 0]
[0, 0]
but am getting:
[1, 0]
[1, 0]
Where is the mistake?
So, I have seen a similar problems with "array of arrays", but I can't use their solution.