title: Find/extract a sequence of integers within a list in python
body: <p>I want to find a sequence of n consecutive integers within a sorted list and return that sequence. This is the best I can figure out (for n = 4), and it doesn't allow the user to specify an n.</p>
  
  <pre><code>my_list = [2,3,4,5,7,9]
  for i in range(len(my_list)):
      if my_list[i+1] == my_list[i]+1 and my_list[i+2] == my_list[i]+2 and my_list[i+3] == my_list[i]+3:
          my_sequence = list(range(my_list[i],my_list[i]+4))
  
  my_sequence = [2,3,4,5]
  </code></pre>
  
  <p>I just realized this code doesn't work and returns an "index out of range" error, so I'll have to mess with the range of the for loop.</p>