I am trying to make a row into a column. That is, I have row = [2, 4, 8]
, and I need [[2], [4], [8]]
.
So I made this code:
row = [2, 4, 8]
column = [[]] * 3
for y in range(3):
column[y].append(row[y])
column
has to be [[2], [], []]
after the first loop. But it was [[2], [2], [2]]
. Does anyone know what's the matter?