title: Count does not work when using index to access list
body: <p>I am trying to count the instances of &quot;1&quot; appearing in a list. When I used index to access the elements in the list and implement a counter, the total number of count is always 1.</p>
  <p>However, when I used the normal &quot;for&quot; iterations, the count actually works. Could anyone enlighten me?</p>
  <p>Here's a snippet of what DOES NOT work:</p>
  <pre><code>for entry in range(len(nums)):
      count = counts = 0
      if nums[entry] == 1:
          count = count + 1
          print(count)
  </code></pre>
  <p>Here's a snippet of what works:</p>
  <pre><code>for num in nums:
      if num == 1:
          counts = counts + 1
  </code></pre>