0
How?Why?Who can explain this to me?
a = [[0]*2]*2 print (a) a[0][0]=5 print (a) b = [[0,0],[0,0]] b[0][0]=6 print (b)
2 Answers
+ 1
[[5,0], [5,0]] -> [[5,0]]*2
This is duplication, as such when multiplying strings.
print(“abc”*2)
“abcabc”
0
I think I got it. Thank you)