I want to combine a number list and a string list
Example a = [1, 2, 3], b = [a, b, c, d]
combine a and b and the answer should be [1, a, 2, b, 3, c, d]
or a = [1,2,3], b = [b, d]
combine a and b and the answer should be [1, b, 2, d, 3]
def combine(a, b):
a = [str(int) for int in a]
b = [str(int) for int in b]
if a and b:
if a[0] > b[0]:
a, b = b, a
return [a[0]] + combine(a[1:], b)
return a + b
a = [1, 2, 3] b = ['a', 'b', 'c', 'd']
combine(a, b)
But I got this
['1', '2', '3', 'a', 'b', 'c', 'd']