title: How to find occurrences of neighboring elements?
body: <p>I am working on a simple program that shoud count the number of occurrences of <code>&quot;11&quot;</code> in an input list of zeros and ones. The output should return a single number, which is the number of occurrences of <code>&quot;11&quot;</code>.</p>
  <p>I have implemented the following code:</p>
  <pre><code>def count_ones(seq):
     # return the number of occurrences as a number
     return sum(1 for i in seq if i != 0)
  
  print(count_ones([0, 0, 1, 1, 1, 0])) # this should print 2
  </code></pre>
  <p>Now it doesn't work as needed. How to improve the given code to get a proper output?</p>