title: Getting an index error in a python fibonacci program
body: <p>I just started "Algorithmic toolbox" on Coursera, and was writing their version of the Fibonacci program in python 2.7  </p>
  
  <pre><code>def fibonacci(n):
      F = []
      F[0] = 0
      F[1] = 1
  
      for i in range(0,n):
          F[i] = F[i-1] + F[i-2]
  
      return F[n]
  
  fibonacci(3)
  </code></pre>
  
  <p>But, I keep getting this error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "fibonacci.py", line 11, in &lt;module&gt;
      fibonacci(3)
    File "fibonacci.py", line 3, in fibonacci
      F[0] = 0
  
  
  IndexError: list assignment index out of range
  </code></pre>