Right code but still test case is not running in python
<p>Given an array of ints, return True if .. 1, 2, 3, .. appears in the array somewhere.</p>

<pre><code>def array123(nums):
    for i in  nums:
       if nums[i:i+3] == [1,2,3]:
          return True
    return False
</code></pre>

<p><a href="http://codingbat.com/prob/p193604" rel="nofollow">Coding bat problem</a></p>

<p>my code is satisfying all the test cases except for nums=[1,2,3]
can someone tell me whats wrong with my code</p>

<p>It should be like this.</p>

<pre><code>def array123(nums):
    for i in range(len(nums)):
        if nums[i:i+3] == [1,2,3]:
            return True
    return False
</code></pre>

<p>Try this. Hope this helps. :)</p>

python python-3.x