title: Invalid Syntax - List index
body: <p>im writing the code below:</p>
  
  <pre><code>def add_to_index(index,keyword,url):
      i=0
      while i&lt;=len(index):
      if keyword in index[i]:
          index[i][1].append(url)
      else:
          index.append([keyword,[url]])
      i=i+2
  </code></pre>
  
  <p>Im curious because when I define the index as </p>
  
  <pre><code>index = []
  </code></pre>
  
  <p>gives me the error <em>list out of range</em>, whats makes sense because there is no entry in my list, but when I define the index as</p>
  
  <pre><code> index=[['udacity',['http_qualquer'],['udacity',['http_any']]]  
  </code></pre>
  
  <p>the error is:</p>
  
  <pre><code>Traceback (most recent call last):
    File "vm_main.py", line 33, in &lt;module&gt;
      import main
    File "/tmp/vmuser_azqmlozsjr/main.py", line 18
      def add_to_index(index,keyword,url):
        ^
  SyntaxError: invalid syntax
  </code></pre>
  
  <p>And there is no error in the syntax of this specific line, if the syntax was wrong the error should have appeared when the index was empty.</p>