title: How to change all the dictionary keys in a for loop with d.items()?
body: <p>I would like some help with understanding why this code is not working as expected.</p>
  
  <p>If one wants to change the key of a dictionary but keep the value, he/she might use:</p>
  
  <pre><code>d[new_key] = d.pop[old_key]
  </code></pre>
  
  <p>I want to modify all the keys (and keep the values in place) but the code below skips certain lines - ("col2") remains untouched. Is it because dictionaries are unordered and I keep changing the values in it?</p>
  
  <p>How would I go about changing the keys and keep the values without creating a new dictionary?</p>
  
  <pre><code>import time
  import pprint
  
  name_dict = {"col1": 973, "col2": "1452 29th Street",
               "col3": "Here is a value", "col4" : "Here is another value",
               "col5" : "NULL", "col6": "Scottsdale",
               "col7": "N/A", "col8" : "41.5946922",
               "col9": "Building", "col10" : "Commercial"}
  
  
  for k, v in name_dict.items():
      print("This is the key: '%s' and this is the value '%s'\n" % (k, v) )
      new_key = input("Please enter a new key: ")
      name_dict[new_key] = name_dict.pop(k)
      time.sleep(4)
  
  pprint.pprint(name_dict)
  </code></pre>