Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from functools import reduce
- list_in = [[], [67, 76, 89], [1, 12], [2, 4, 6, 8, 10, 11], [3, 5, 7]]
- def sort(list_1, list_2):
- index_1 = 0
- index_2 = 0
- list_out = []
- while True:
- if index_1 == len(list_1):
- list_out.extend(list_2[index_2:])
- break
- if index_2 == len(list_2):
- list_out.extend(list_1[index_1:])
- break
- if list_1[index_1] <= list_2[index_2]:
- list_out.append(list_1[index_1])
- index_1 += 1
- else:
- list_out.append(list_2[index_2])
- index_2 += 1
- return list_out
- print(list(reduce(sort, list_in)))
Add Comment
Please, Sign In to add comment