title: python - comparing order of list without sorting existing data
body: <p>I am sorry if the title is little confusing but its not really that complicated either. I am trying to implement a logic where I will be just printing out list items which have correct order as per another list. For example let's say I have following lists:</p>
  
  <pre><code>a = [(299,70), (323,70), (448,70), (548,70), (613,70), (745,70)]
  b = [(613,70), (448,70), (548,70), (323,70), (299,70)] 
  </code></pre>
  
  <p><strong>What I want</strong></p>
  
  <p>I want to print output of such elements in list <code>b</code> which are in same order as in list <code>a</code>. In above case it can be seen that only two elements are following the order in <code>b</code> and they are:</p>
  
  <pre><code>c= [(448,70), (548,70)]
  </code></pre>
  
  <p><strong>P.S.</strong> I am comparing <code>b</code> with <code>a</code> and intending to keep the order of <code>b</code> same as it was generated in my program. I DON'T want to use any sorting method that can alter the  order of existing <code>b</code> list. </p>
  
  <p>The reason for not using sorting is the task I am working on has <code>a</code> list as a reference and <code>b</code> list is my implementation. so after <code>b</code> is generated I simply want to print such elements which have matching order without altering(changing order) any element during comparison. </p>
  
  <p><strong>What I tried</strong></p>
  
  <p>I tried comparing indexes of numbers inside the list instead of values, but it yields no satisfactory results. Additionally this method fails terribly when two lists are of different size as in above case. </p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Sorry for all the confusions. As asked here is one more example of same kind and more clear description of what I want. </p>
  
  <p>I have two lists of tuples as given below:</p>
  
  <pre><code>list1 = [(1,2),(3,4),(5,6),(7,8),(9,10)]
  list2 = [(1,2),(5,6),(3,4),(7,8),(9,10)]
  </code></pre>
  
  <p>I want to print out consecutive pairs of tuples in <code>list2</code> which are in same order as given in <code>list1</code>. So in this example the output should be </p>
  
  <pre><code>list3 = [(7,8),(9,10)]
  </code></pre>
  
  <p>No matter what is the size of both the lists, what I want is only the common consecutive tuples to be printed which are present in both. </p>