title: First occurrence of a number in python list
body: <p>I have a long list which consist of two fixed possible numbers (0 and 1). e.g:</p>
  <pre><code> l = [0,0,0,0,0,1,1,1,1,1,1,1]
  </code></pre>
  <p>I don't know  which number occurs first in the list but I am sure that if 0
  is occurring first in the list then it will occur consecutively followed by 1, same case for 1.</p>
  <p>I am performing some kind of action on the basis of these number conditions (0,1) but also I need to show a message before the first occurrence of 0 and 1.</p>
  <p>First occurrence of first number (in this case 0), I have managed like this.</p>
  <pre><code>if l[0] == 0:
     print ('first occurrence of 0')
  elif l[0] == 1:
     print ('first occurrence of 1')
  </code></pre>
  <p>I am not sure how to point out first occurrence of 1 during execution of this list.</p>
  <p>For this example list I need result like this.</p>
  <pre><code> msg before first occurrence of 0
   0
   0
   0
   0
   0
   msg before first occurrence of 1
   1
   1
   1
   1
   1
   1
   1 
  </code></pre>