title: Check if next element of list is the same as previous one
body: <pre><code>l=['1', '1', '3289', '3289', '3290', '3290', '3291', '3291', '3292', '3292', '3293', '3293', '3294', '3294']
  </code></pre>
  <p>I want to do a some kind of loop that checks if the number is the same as next one. If not then do something.</p>
  <p>I came up with this:</p>
  <pre><code>for idx, x in enumerate(l):
    if idx+1 &lt;= len(l)-1:
      print(idx)
      if x[idx] == x[idx+1]:
        pass
      else:
        print('cat')  # do something
    else:
      pass
  </code></pre>
  <p>but i keep passing the list index. I have no idea how to make this if statement.</p>
  <p>For example i would like to insert missing numbers into the list like so:</p>
  <pre><code>['1', '1', '2', '2', '3', '3',....,'3288', '3288', '3289', '3289', '3290', '3290', '3291', '3291', '3292', '3292', '3293', '3293', '3294', '3294']
  </code></pre>