``````

In [9]:

def join(a, b):
length = len(a) if len(a) < len(b) else len(b)
return [[a[i], b[i]] for i in range(length)]

print(join([], []))
print(join([], ["a","b","c"]))
print(join([1,2], ["a","b","c"]))
print(join([1,2,3], ["a","b","c"]))

``````
``````

[]
[]
[[1, 'a'], [2, 'b']]
[[1, 'a'], [2, 'b'], [3, 'c']]

``````
``````

In [15]:

def split(l):
result_a = []
result_b = []

for i in range(len(l)):
result_a.append(l[i][0])
result_b.append(l[i][1])

return result_a, result_b

print(split([[1, 'a'], [2, 'b'], [3, 'c']]))
print(split([[1, 'a']]))
print(split([]))

``````
``````

([1, 2, 3], ['a', 'b', 'c'])
([1], ['a'])
([], [])

``````
``````

In [27]:

def shaker_sort(l):
result = l.copy()
for j in range(len(result)):
for i in range(j, len(result)-1):
if result[i] > l[i+1]:
result[i], result[i+1] = result[i+1], result[i]
for i in range(len(l)-1, j, -1):
if result[i-1] > result[i]:
result[i-1], result[i] = result[i], result[i-1]
return result

print(shaker_sort([7,5,11,10,8]))
print(shaker_sort([2, 6, 8, 1, 7, 9, 4, 3, 5]))
print(shaker_sort([10, 11, 3, 2, 5, 8, 1]))
print(shaker_sort([10, 3, 2, 5, 8, 1]))

``````
``````

[5, 7, 8, 10, 11]
[1, 2, 3, 4, 5, 6, 7, 8, 9]
[1, 2, 3, 5, 8, 10, 11]
[1, 2, 3, 5, 8, 10]

``````
``````

In [39]:

def odd_even_sort(l):
l = l.copy()

for j in range(len(l)):
for i in range(1, len(l)-1, 2):
if l[i] > l[i+1]:
l[i], l[i+1] = l[i+1], l[i]
for i in range(0, len(l)-1, 2):
if l[i] > l[i+1]:
l[i], l[i+1] = l[i+1], l[i]
return l

print(odd_even_sort([1,7,5,2,6]))
print(odd_even_sort([2, 6, 8, 1, 7, 9, 4, 3, 5]))
print(odd_even_sort([10, 11, 3, 2, 5, 8, 1]))
print(odd_even_sort([10, 3, 2, 5, 8, 1]))

``````
``````

[1, 2, 5, 6, 7]
[1, 2, 3, 4, 5, 6, 7, 8, 9]
[1, 2, 3, 5, 8, 10, 11]
[1, 2, 3, 5, 8, 10]

``````
``````

In [ ]:

``````