title: Why does "in" work for keys but not for strings?
body: <p>I came across a very weird thing with strings and dictionaries in Python today. Can someone explain to me why the print statement works in the first for loop but fails in the second for loop?</p>
  
  <pre><code>test = 'ab'
  test_dict = {}
  test_dict[test] = 1
  
  for x, y in test_dict:
      print('%s %s' % (x,y))
  
  for x,y in test:
      print('%s %s' % (x,y))
  </code></pre>