title: Remove items from list if they are within a given range
body: <p>I want to remove every item from a sorted list, when it is within 100 seconds from one of the previous events. Example:</p>
  
  <pre><code>event_list = [3, 10, 12, 140, 140, 150, 300]
  filtered_event_list = [3, 140, 300]
  </code></pre>
  
  <p>I have the following piece of code that seems to work. But it does not remove an item that has the same time as the previous one. Another problem Ihave is that it is not very pythonic since I need an additional placeholder for true/false or 0/1 to store my result before I start removing the items that are within 100 seconds.</p>
  
  <pre><code>downCycles = 100
  event_list = [[3, 0], [10, 0], [12, 0], [140, 0], [140, 0], [150, 0], [300, 0]]
  
  for e_idx, event in enumerate(event_list):
  
  if e_idx &gt; 0:
  
      prev_idx = e_idx - 1
  
      while event[0] - event_list[prev_idx][0] &lt; downCycles and prev_idx &gt;= 0:
  
          event[1]  = event[0] - event_list[prev_idx][0]
          prev_idx -= 1
  
  filtered_event_list = [e for e in event_list if e[1] == 0]
  # filtered_event_list = [[3, 0], [140, 0], [140, 0], [300, 0], [800, 0]]
  </code></pre>
  
  <p>Has anybody an idea for removing the second 140 in this example?
  Has anybody a better way to write this piece of code?</p>
  
  <p>Thanks 
  Regards
  Michael</p>