I creat a 2d array using two methods they look the same
helper1=[[]]*5
helper=[[] for i in range(5)]
when I append new element to the arrays, they behave differently
helper1[0].append(1)
result is [[1], [1], [1], [1], [1]]
helper[0].append(1)
result is [[1], [], [], [], []]
I am surprised by the first outcome , why it is so? thanks !