title: python defaultdict(list) IndexError: list assignment index out of range
body: <p>I am trying to use <code>defaultdict(list)</code> as,</p>
  
  <pre><code>dict = defaultdict(list)
  dict['A'][1] = [1]
  </code></pre>
  
  <p>or</p>
  
  <pre><code>dict['A'][1] = list([1])
  </code></pre>
  
  <p>I got an error,</p>
  
  <pre><code>IndexError: list assignment index out of range
  </code></pre>
  
  <p>if I do</p>
  
  <pre><code>dict['A'][1].append(1)
  
  IndexError: list index out of range
  </code></pre>
  
  <p>I am wondering what is the issue here.</p>