title: In Python, why is my for-loop excluding the number before a specific number only when that number is the last in the array?
body: <p>I am working on a codingbat problem, and I am getting unexpected results when the excluded number is at the end of the array.</p>
  
  <pre><code>def sum13(nums):
    a = []
  
    if len(nums) == 0:
      return 0
    for i in range(len(nums)):
      if nums[i] == 13 or nums[i-1] == 13:
        continue
      a.append(nums[i])
  
    return sum(a)
  </code></pre>
  
  <p>The code should append all numbers in the array to list a and return the sum, excluding any instances of the number 13 and the number immediately following it. It works fine for most of the tests, but when the array ends in 13, it doesn't append the number at index 0 to the list, returning the wrong result.</p>