title: Iterate over a dynamic dictionary
body: <p><strong>Summary</strong>:</p>
  
  <p>I want to iterate over a dictionary which is dynamic.</p>
  
  <p>Here dynamic means we will be deleting one key,value pair after some condition. So, lenght of dictionary will be changed.
  But I am getting error in python: </p>
  
  <pre><code>RuntimeError: dictionary changed size during iteration
  </code></pre>
  
  <p><strong>Example:</strong></p>
  
  <p>Lets have a code here:</p>
  
  <pre><code>a = {'p':'q','q':'r','s':'t'}
  
  for key,value in a.items():
      if key == 'q':
          &lt;some code here&gt;
         del a[key]
         &lt;some code here&gt;
  </code></pre>
  
  <p>It gives Runtime Error over changing size of dict.</p>