title: Python looping over dictionary to substitute keys with the values from another dictionary
body: <p>I have a dictionary, i want to change all the keys in that dictionary to the values in another dictionary.</p>
  
  <p>For example:</p>
  
  <pre><code>X = {"apple" : 42}
  
  Y = {"apple" : "Apples"}
  </code></pre>
  
  <p>After converting:</p>
  
  <p>Dict <code>X = {"Apples" : 42}</code></p>
  
  <pre><code>def convert(items, ID):
      for key, value in items.items():
          for keys, values in ID.items():
              if keys == key:
                  key = values
      return items
  </code></pre>
  
  <p>So I've written the above code in order to do this, however after executing this function, I print the dictionary and the keys have not changed.</p>