title: Python dictionary key error when assigning - how do I get around this?
body: <p>I have a dictionary that I create like this:</p>
  
  <pre><code>myDict = {}
  </code></pre>
  
  <p>Then I like to add key in it that corresponds to another dictionary, in which I put another value:</p>
  
  <pre><code>myDict[2000]['hello'] = 50
  </code></pre>
  
  <p>So when I pass <code>myDict[2000]['hello']</code> somewhere, it would give <code>50</code>.</p>
  
  <p>Why isn't Python just creating those entries right there? What's the issue? I thought KeyError only occurs when you try to read an entry that doesn't exist, but I'm creating it right here?</p>