title: Python: create for-loop until two lists match
body: <p>I am trying to match two lists until they match:</p>
  
  <p>So let's say I have</p>
  
  <p><code>bought = [12, 10, 5]</code></p>
  
  <p><code>sold = [4, 6, 3, 2, 12]</code></p>
  
  <p>Eventually, I want to create a for-loop over both lists that keeps looping until all numbers match. So it would find all current matches and keeps creating splits for numbers that do not match</p>
  
  <p>In the above example, it would start with 12 being a match for both lists. Then there is 10 which does not match anything but the closest element in the other list is 6, leaving behind 4 which is also a match from the other list. </p>
  
  <p>The above would then eventually become</p>
  
  <p><code>result = [12, 6, 4, 3, 2]</code></p>
  
  <p>I was wondering whether there is a Python function such as <code>intersections</code> that can maybe be of help to do this efficiently?</p>
  
  <p>Rules:
  1. Sum of two lists is always equal</p>