For example, I have two lists:
[1, 2, 3, 4, 5]
[6, 7, 8, 9, 10]
Is there any way to get this list out of these?
[(1, 6), (2, 7), (3, 8), (4, 9), (5, 10)]
For example, I have two lists:
[1, 2, 3, 4, 5]
[6, 7, 8, 9, 10]
Is there any way to get this list out of these?
[(1, 6), (2, 7), (3, 8), (4, 9), (5, 10)]
Use zip
to interleave lists and form list of tuples:
lst1 = [1, 2, 3, 4, 5]
lst2 = [6, 7, 8, 9, 10]
print(list(zip(lst1, lst2)))
# [(1, 6), (2, 7), (3, 8), (4, 9), (5, 10)]