[Solved] How to map two lists in python? [closed]


You can do this with map function as well, but if with loop, here’s your answer. We have to concatenate the first elements of all three list, second with second and third with third. So make a loop going from zero to len(<any_list>) [because all three list have same len] and concatenate all three. Your code:

list1=["a","b","c"]
list2=["d","e","f"]
list3=[1,2,3]
list4=[]
for i in range(0,len(list1)):
    list4. append (list1[i]+list2[i]+str(list3[i]))

print(*list4)

solved How to map two lists in python? [closed]