Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. list1 = [1,3,4,5,9,13]
  2. list2 = [2,10,12]
  3.  
  4. out = []
  5.  
  6. while len(list1) and len(list2):
  7. if list1[0] < list2[0]:
  8. out += [list1[0]]
  9. list1 = list1[1:]
  10. else:
  11. out += [list2[0]]
  12. list2 = list2[1:]
  13.  
  14. out += list1 + list2
  15.  
  16. print out
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement