title: How to check if a list is a subsequence of another list in order
body: <p>I have a list <code>input</code>:</p>
  <pre><code>[1, 2, 4, 3, 5, 7, 5, 3, 8, 3, 8, 5, 8, 5, 9, 5, 7, 5, 7, 4, 9, 7, 5, 7, 4, 7, 4, 7, 8, 9, 7, 5, 7, 5, 4, 9, 3, 4, 8, 4, 8, 5, 3, 5, 4, 7, 3, 7, 3, 1, 2, 7, 1, 7, 2, 1]
  </code></pre>
  <p>I need to check if the elements of a <code>lookup_list</code> <code>[1,2,3,4,5,7,8,9,5,4,3,2,1]</code> are present in the above list in a spread out manner in the same sequence.</p>
  <p>This will illustrate what I am trying to say:</p>
  <p>[<strong>1</strong>, <em><strong>2</strong></em>, 4, <em><strong>3</strong></em>, 5, 7, 5, 3, 8, 3, 8, 5, 8, 5, 9, 5, 7, 5, 7, <em><strong>4</strong></em>, 9, 7, <em><strong>5</strong></em>, <em><strong>7</strong></em>, 4, 7, 4, 7, <em><strong>8</strong></em>, <em><strong>9</strong></em>, 7, <em><strong>5</strong></em>, 7, 5, <em><strong>4</strong></em>, 9, <em><strong>3</strong></em>, 4, 8, 4, 8, 5, 3, 5, 4, 7, 3, 7, 3, 1, <em><strong>2</strong></em>, 7, 1, 7, 2, <em><strong>1</strong></em>]</p>
  <p>The numbers in bold are the numbers from the <code>lookup_list</code> present in the <strong>same order</strong> in the <code>input</code> list, but with other irrelevant items in between as well.</p>
  <p>Is there any way I can check for this?</p>
  <p>This is the method I tried:</p>
  <pre><code>count = 0
  a = 0
  indices = []
  for item in list:
      idx = -1
      if count &lt; len(input_list):
          idx = list.index(input_list[count])
          if idx != -1:
              a = a +len(list[:idx])
              list = list[idx:]
              indices.append(a + idx)
      count = count +1
  print(indices)
  </code></pre>
  <p>but it gave me the following result:</p>
  <pre><code>[0, 2, 5, 35, 25, 24, 33, 30, 33, 37, 38, 64, 54]
  </code></pre>
  <p>The issue is, the order of the <code>lookup_list</code> is not maintained in this method.</p>