I have a nested list called
inputs. Let's assume that it is like so
inputs = [[1,0,1],[0,0,1]]
Now I added 3 empty lists (row_1,row_2,row_3) they should be appended by the respectful index in a list in the nested list. For further explanation:
#They should be like this
row_1 = [1,0]
row_2 = [0,0]
row_3 = [1,1]
What I have tried:
row_1 = []
row_2 = []
row_3 = []
for lists in inputs:
for index in lists:
row_1.append(inputs[index - 1][0])
row_2.append(inputs[index - 1][1])
row_3.append(inputs[index - 1][2])
Which resulted in:
row_1 = [1,0,1,1,1,1]
row_2 = [0,0,0,0,0,0]
row_3 = [1,1,1,1,1,1]
I suspect that the problem is in the for loop. Can it be solved with a while loop?