I have a list X. I want to append elements of X[0][0],X[1][0],X[2][0], X[1][0],X[1][1],X[2][1] and so on. I present the current and expected outputs.
X=[[[1], [2], [3], [4], [5]], [[8], [4], [6], [2], [3]],[[9], [1], [2], [5], [1]]]
X1=[]
for i in range(0,len(X)):
for j in range(0,len(X[0])):
X1=X[i][j]
X1.append(X)
The current output is
[1,
[[[1, [...]], [2, [...]], [3, [...]], [4, [...]], [5, [...]]],
[[8, [...]], [4, [...]], [6, [...]], [2, [...]], [3, [...]]],
[[9, [...]], [1, [...]], [2, [...]], [5, [...]], [...]]]]
The expected output is
[[1,8,9], [2,4,1], [3,6,2], [4,2,5], [5,3,1]]
X1.append(X[i][j])& remove the line just above thatX1.append(X[i][j])yields[[1], [2], [3], [4], [5], [8], [4], [6], [2], [3], [9], [1], [2], [5], [1]]which is not the expected output.