title: Coding bat (Python > List-2 > has22)
body: <p><a href="http://codingbat.com/prob/p119308" rel="nofollow">link</a></p>
  
  <p>the answer is </p>
  
  <pre><code>def has22(nums):
    for i in range(0, len(nums)-1):
      #if nums[i] == 2 and nums[i+1] == 2:
      if nums[i:i+2] == [2,2]:
        return True    
    return False
  </code></pre>
  
  <p>I don't understand why there's a "-1" after len(nums). This question is probably more algebra related... </p>