import heapq list_a = [1, 3, 6, 7, 9] list_b = [2, 4, 5, 8, 10] result = list(merge(list_a, list_b)) print(result )