title: Set the index of a Python array
body: <p>I'm trying to set the index of an array in Python, but it isn't acting as expected:</p>
  
  <pre><code>theThing = []
  theThing[0] = 0
  '''Set theThing[0] to 0'''
  </code></pre>
  
  <p>This produces the following error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "prog.py", line 2, in &lt;module&gt;
      theThing[0] = 0;
  IndexError: list assignment index out of range
  </code></pre>
  
  <p>What would be the correct syntax for setting an index of an array in Python?</p>