How to add two list up in alternate positions?
E.g. I have:
>>> x = [1,3,5,7,9]
>>> y = [2,4,6,8,10]
and when i add the list up, i get:
>>> x + y
[1, 3, 5, 7, 9, 2, 4, 6, 8, 10]
but the desired output is:
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
I have tried this but is there other way to achieve the desired output?
>>> z = []
>>> for i,j in zip(x,y):
... z.append(i)
... z.append(j)
...
>>> z
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]