0

How to combine two lists by alternatively taking elements. For example: given the two lists ['a','b','c'] and [1, 2, 3, 4], the function should return [a, 1, b, 2, c, 3, 4]

John Constantine
  • 1,038
  • 4
  • 15
  • 43

1 Answers1

0
a = [1, 2, 3, 4]
b = ['a','b','c'] 

result = [item for sublist in zip(b,a) for item in sublist]

print result
pSaadi
  • 190
  • 9