see the code below:
a=[1,2,3,4]
m=[0,0]
q=[]
for n in a:
m[0]=n
for n in a:
m[1]=n
q.append(m)
print(q)
the desired output should be:
[[1, 1], [1, 2], [1, 3], [1, 4], [2, 1], [2, 2], [2, 3], [2, 4], [3, 1], [3, 2], [3, 3], [3, 4], [4, 1], [4, 2], [4, 3], [4, 4]]
but instead the output is:
[[4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4]]
any thoughts why?