title: javascript to python array translation
body: <p>We are working on a project where we are translating javaScript code into python. Everything is going pretty smoothly, except for this one line of code that has given us errors on multiple translations:</p>
  
  <blockquote>
    <p>"primes" is an empty array BTW.</p>
  </blockquote>
  
  <p>JavaScript:</p>
  
  <pre><code> var primes = [];
  
   if(primes[primes.length - 1] &gt; 3){...}
  </code></pre>
  
  <p>Python:</p>
  
  <pre><code> primes = []
  
   if primes[len(primes) - 1] &gt; 3:
        ......
  </code></pre>
  
  <p>This code works in javascript, however in Python we get an error. It seems as though we are trying to access an index of the list that doesn't exist.</p>
  
  <p>This is the error: </p>
  
  <blockquote>
    <p>TypeError: object of type 'int' has no len()</p>
  </blockquote>
  
  <p>Does anyone have a workaround?  </p>