title: How to filter dictionary keys based on its corresponding values
body: <p>I have:</p>
  
  <pre><code>dictionary = {"foo":12, "bar":2, "jim":4, "bob": 17}
  </code></pre>
  
  <p>I want to iterate over this dictionary, but over the values instead of the keys, so I can use the values in another function.</p>
  
  <p>For example, I want to test which dictionary values are greater than <code>6</code>, and then store their keys in a list. My code looks like this:</p>
  
  <pre><code>list = []
  for c in dictionary:
      if c &gt; 6:
          list.append(dictionary[c])
  print list
  </code></pre>
  
  <p>and then, in a perfect world, <code>list</code> would feature all the keys whose value is greater than <code>6</code>.
  However, my <code>for</code> loop is only iterating over the keys; I would like to change that to the values!</p>
  
  <p>Any help is greatly appreciated.
  thank you</p>