title: How to iterate over a dictionary to make new for loop for the remaining elements?
body: <p>I am trying to make a new dictionary from the one which I'm having.</p>
  
  <pre><code>`dict1 = {'A':{}, 'B':{}, 'C':{}, 'D':{}, 'E':{}}
   for key, val in dict1.iteritems():
      mytest = key
      newConditionFlag = getSummary(mytest)
      if newConditionFlag == 1:
          make dict2`
  </code></pre>
  
  <p>where getSummary function is as follows:</p>
  
  <pre><code>`def getSummary(mytest):
      newConditionFlag==0
      bVal = mytest.CanClose()
      if bVal == True:
          pass
      else:
          newConditionFlag=1
      return newConditionFlag`
  </code></pre>
  
  <p>If newConditionFlag == 1 for B, then my dict2 should be </p>
  
  <p><code>dict2 = 'C':{}, 'D':{}, 'E':{}}</code>. 
  In the same way if newConditionFlag == 1 for C, </p>
  
  <p><code>dict2 = 'D':{}, 'E':{}}</code>.
  How should I do this?</p>
  
  <p>I know for a simple condition if we want to access remaining values what we do is</p>
  
  <pre><code>`l = [1,2,3,4,5]
  for i,j in zip(l, l[2:]):
      print j`
  </code></pre>
  
  <p>But what should be done in case of dictionary? If we try it the same way it gives <code>TypeError: unhashable type</code></p>