I have been trying to make a Python code that is straightforward in concept but I have been unsuccessful at figuring out how to do so with an elegant code.
Basically, given two ascending-sorted lists of integers:
A = [5, 6, 7, 9, 35, 47, 88, 100]
B = [3, 12, 44, 78, 94, 122, 186]
C = []
Starting from list A, I want to bin the next higher number in a successive list (A-B-A-B-A. As such) into an empty list C.
In execution, this would produce
C = [5,12,35,44,47,78,88,94,100,122]
And end at 122, as we cannot find any number higher in list A.