Recently while I was practicing Python, I came up with the problem. I created two different empty lists one using list comprehension and next using the "multiplication" way.
Structurally both the lists are similar.
Afterwards, when I assign the value of array[0][0]=1 and try to print the list the result goes like this.
a=[[0 for i in range(3)] for j in range(3)]
b=[[0]*3]*3
print(a)
print("#####")
print(b)
a[0][0]=1
b[0][0]=1
print("#################")
print(a)
print("#####")
print(b)
My problem is why on array b all the values at the beginning of each lists gets replaced by 1 whereas not in array a. I need a geniune answer for it.
