Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. # Merging Two Arrays to a Third Array
  2.  
  3. List1 = [1115, 1345, 1567, 1696, 1783, 1980, 9998]
  4. List2 = [1105, 1379, 1394, 1412, 1696, 1701, 9999]
  5. List3 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  6.  
  7. # continue your program below
  8.  
  9. p = 0
  10. q = 0
  11. i = 0
  12. run = True
  13.  
  14. while run == True:
  15.  
  16. if List2[p] > List1[q]:
  17. List3[i] = List1[q]
  18. i = i +1
  19. if List1[q] == 9998:
  20. run = False
  21. q = q + 1
  22.  
  23. else:
  24. if List2[p] == List1[q]:
  25. print("Error",List2[p])
  26. else:
  27. List3[i] = List2[p]
  28. i = i +1
  29. p = p + 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement