title: loop from end to start
body: <p>At first, I use python 2 days and have more questions.
  Below one from them.</p>
  
  <p>I have a list (3297 items), i want find index of first item from end where value != 'nan'</p>
  
  <p>Example: (index, value)</p>
  
  <pre><code>[0]  378.966
  [1]  378.967
  [2]  378.966
  [3]  378.967
  ....
  ....
  [3295]  777.436
  [3296]  nan
  [3297]  nan
  </code></pre>
  
  <p>if want found item with index - 3295</p>
  
  <p>my code (from end to start, step by step)</p>
  
  <pre><code>    i = len(lasarr); #3297
      while (i &gt;= 0):
              if not math.isnan(lasarr[i]):
                     method_end=i # i found !
                     break        # than exit from loop
              i=i-1 # next iteration
  </code></pre>
  
  <p>run and get error</p>
  
  <blockquote>
  <pre><code>Traceback (most recent call last):
    File "./demo.py", line 37, in &lt;module&gt;
      if not math.isnan(lasarr[i]):
  IndexError: index out of bounds
  </code></pre>
  </blockquote>
  
  <p>what i do wrong?</p>