list_a = [1,7,9,35,36,37]
list_b = [3,4,5,40]
Expected output:
list_merged = [1,3,4,5,7,9,35,36,37,40]
Condition : must traverse both list only once
I know of zip
which works as below and does quite fit in my requirement.
>>> x = [1, 2]
>>> y = [1, 3, 4, 5, 6]
>>> zip(x,y)
[(1, 1), (2, 3)]
>>> zip(y, x)
[(1, 1), (3, 2)]