title: Python Dice : Avoiding Triple Repetitions
body: <p>I got this DICE puzzle to solve and my mind is stuck on a scenario.</p>
  
  <hr>
  
  <p>How many times did it occur in the trial, that exactly two <code>6</code> were rolled after each other? For example, in sequence <code>56611166626634416</code> it occurred twice, that exactly two <code>6</code> were thrown after each other.</p>
  
  <hr>
  
  <p><strong>Question is: how to avoid letting the counter count those 666.</strong></p>
  
  <p>Note: I  have tried multiple trackers (keys), but then I have another issue which is:</p>
  
  <blockquote>
    <p>IndexError: list index out of range</p>
  </blockquote>
  
  <pre><code>Throws=[6,6,2,6,6,6,3,6,6,3,6,6,6]
  Counter_6 = 0
  X=0
  
  
  for i in range (0,len(Throws)):
  
      if i==len(Throws) or i+1&gt;len(Throws) or i+2&gt;len(Throws):
          key1= Throws[i]
          key2=0
          key3=0
  
      elif i+2&gt;=len(Throws):
          key1 = Throws[i]
          key2 = Throws[i + 1]
          key3 = 0
  
      else:
          key1=Throws[i]
          key2 = Throws[i + 1]
          key3 = Throws[i + 2]
      print("key 1 is", key1)
      print("key 2 is", key2)
      print("key 3 is", key3)
  
      if key1==6 and key2==6 and key3!=6 and X==0:
          Counter_6 = Counter_6 + 1
          X=1
      elif key1!=6 and key2 ==6 and key3==6 and X==0:
          Counter_6 = Counter_6 + 1
          X=1
      elif key1==6 and key2==6 and key3==6:
          Counter_6 = Counter_6
          X=0
  
  print("number of double 6 are: ",Counter_6)
  </code></pre>
  
  <p>Counter should be equal to 2</p>