Suppose I have list_A and list_B:
list_A = [1, 1, 1, 1, 1]
list_B = [2, 2, 2, 2, 2]
How can achieve a third list mixing them like this: [1, 2, 1, 2, 1, 2, 1, 2, 1, 2]
Language: Python 3
Thanks
Suppose I have list_A and list_B:
list_A = [1, 1, 1, 1, 1]
list_B = [2, 2, 2, 2, 2]
How can achieve a third list mixing them like this: [1, 2, 1, 2, 1, 2, 1, 2, 1, 2]
Language: Python 3
Thanks
Is this what you are looking for?
list_A = [1, 1, 1, 1, 1]
list_B = [2, 2, 2, 2, 2]
c = list(zip(list_A,list_B))
print (c)
Output will be as follows:
[(1, 2), (1, 2), (1, 2), (1, 2), (1, 2)]
Or are you looking for :
[1, 2, 1, 2, 1, 2, 1, 2, 1, 2]