title: Count all sequences in a list
body: <p>My self-learning task is to find how many sequences are on the list. A sequence is a group of numbers, where each is one 1 bigger than the previous one. So, in the list:</p>
  <pre><code>[1,2,3,5,8,10,12,13,14,15,17,19,21,23,24,25,26]
  </code></pre>
  <p>there are 3 sequences:</p>
  <ul>
  <li><code>1,2,3</code></li>
  <li><code>12,13,14,15</code></li>
  <li><code>23,24,25,26</code></li>
  </ul>
  <p>I've spent few hours and got a solution, which I think is a workaround rather than the real solution.</p>
  <p>My solution is to have a separate list for adding sequences and count the attempts to update this list. I count the very first appending, and every new appending except for the sequence, which already exists.</p>
  <p>I believe there is a solution without additional list, which allows to count the sequences itself rather than the list manipulation attempts.</p>
  <pre><code>numbers = [1,2,3,5,8,10,12,13,14,15,17,19,21,23,24,25,26]
  
  goods = []
  count = 0
  
  for i in range(len(numbers)-1):
      if numbers[i] + 1 == numbers[i+1]:
  
          if goods == []:
              goods.append(numbers[i])
              count = count + 1
  
          elif numbers[i] != goods[-1]:
              goods.append(numbers[i])
              count = count + 1
  
          if numbers[i+1] != goods[-1]:
              goods.append(numbers[i+1])
  </code></pre>
  <p>The output from my debugging:</p>
  <pre><code>Number 1 added to: [1]
  First count change: 1
  
  Number 12 added to: [1, 2, 3, 12]
  Normal count change: 2
  
  Number 23 added to: [1, 2, 3, 12, 13, 14, 15, 23]
  Normal count change: 3
  </code></pre>