I have
a = [1, 2]
b = ['a', 'b']
I want
c = [1, 'a', 2, 'b']
I have
a = [1, 2]
b = ['a', 'b']
I want
c = [1, 'a', 2, 'b']
Simple.. please follow this pattern.
x = [1 , 2 , 3]
y = ["a" , "b" , "c"]
z =list(zip(x,y))
print(z)
Here is a standard / self-explaining solution, i hope someone will find it useful:
a = ['a', 'b', 'c']
b = ['1', '2', '3']
c = []
for x, y in zip(a, b):
c.append(x)
c.append(y)
print (c)
output:
['a', '1', 'b', '2', 'c', '3']
Of course, you can change it and do manipulations on the values if needed