I found this merge sort solutions online and I'm wondering if while loops is the way to go or if there is also a way of using 2 for loops and comparing those.
def merge(l, m):
result = []
i = j = 0
total = len(l) + len(m)
while len(result) != total:
if len(l) == i:
result += m[j:]
break
elif len(m) == j:
result += l[i:]
break
elif l[i] < m[j]:
result.append(l[i])
i += 1
else:
result.append(m[j])
j += 1
print result
merge([1,2,6,7], [1,3,5,9])