title: Python 3 changing value of dictionary key in for loop not working
body: <p>I have python 3 code that is not working as expected:</p>
  
  <pre><code>def addFunc(x,y):
      print (x+y)
  
  def subABC(x,y,z):
      print (x-y-z)
  
  def doublePower(base,exp):
      print(2*base**exp)
  
  def  RootFunc(inputDict):
      for k,v in inputDict.items():
          if v[0]==1:
              d[k] = addFunc(*v[1:])
          elif v[0] ==2:
              d[k] = subABC(*v[1:])
          elif  v[0]==3:
              d[k] = doublePower(*v[1:])
  
  
  d={"s1_7":[1,5,2],"d1_6":[2,12,3,3],"e1_3200":[3,40,2],"s2_13":[1,6,7],"d2_30":[2,42,2,10]}
  RootFunc(d)
  
  #test to make sure key var assignment works
  print(d)
  </code></pre>
  
  <p>I get:</p>
  
  <pre><code>{'d2_30': None, 's2_13': None, 's1_7': None, 'e1_3200': None, 'd1_6': None}
  </code></pre>
  
  <p>I expected:</p>
  
  <pre><code>{'d2_30': 30, 's2_13': 13, 's1_7': 7, 'e1_3200': 3200, 'd1_6': 6}
  </code></pre>
  
  <p>What's wrong? </p>
  
  <p>Semi related: I know dictionaries are unordered but is there any reason why python picked this order? Does it run the keys through a randomizer?</p>