I have 3 lists and want to merge them as a list by using map not just zip.
a=[1,1,1,1]
b=[2,2,2,2]
c=[3,3,3,3]
I want to obtain list bellow
f=[[1,2,3],[1,2,3],[1,2,3],[1,2,3]]
i am using python3 would you please educate me how can i do?
I have 3 lists and want to merge them as a list by using map not just zip.
a=[1,1,1,1]
b=[2,2,2,2]
c=[3,3,3,3]
I want to obtain list bellow
f=[[1,2,3],[1,2,3],[1,2,3],[1,2,3]]
i am using python3 would you please educate me how can i do?
You can do it with a simple loop. Loop through the index and create a list of the elements for each list at that particular index. Then append that list to the f
.
f = []
for i in range(len(a)):
f.append([a[i], b[i], c[i]])
print(f)