i am trying to make a nested list using append function, but the last value will recover pervious values, anyone can tell me why, and how to do it correctly. thanks
d= []
temp = [0,0,0]
for i in range(4):
temp[0] = i+1
d.append(temp)
the output shows:
[[4, 0, 0], [4, 0, 0], [4, 0, 0], [4, 0, 0]]
but the output that i want is
[[1, 0, 0], [2, 0, 0], [3, 0, 0], [4, 0, 0]]