title: reversing dictionary in python doesn't work
body: <p>This is a code for switching between the key and value in a dictionary:</p>
  
  <pre><code>for k in d:
      d[d[k]] = k
      d.pop(k)
  </code></pre>
  
  <p>The problem with this code that it makes more operations that it should make, and for some inputs return the wrong result </p>
  
  <p>what is the reason of this problem?</p>