title: How can I check a previous index when iterating through a for loop python
body: <p>I have a list that is somewhat random. </p>
  
  <pre><code>list  = [1,2,4,2,25,3,2,4,2,1,1,32,3,3,2,2,23,4,2,2,2,34,234,33,2,4,3,2,3,4,2,1,3,4,3]
  </code></pre>
  
  <p>I want to iterate through it and do something like this: </p>
  
  <pre><code>for item in list:
      while item &gt;=5:
          if item = item_5_indexes_ago
              print "its the same as it was 5 entries ago!"
  </code></pre>
  
  <p>Obviously, item_5_indexes_ago is not valid python. What should I substitute here? I want to check if list[5]==list[1], if list[6]==list[2], ..... for every item in the list. </p>