title: Python - Replacing words in a string with entries from a dictionary
body: <p>I am trying to make a program that will take an input, look to see if any of these words are a key in a previously defined dictionary, and then replace any found words with their entries. The hard bit is the "looking to see if words are keys". For example, if I'm trying to replace the entries in this dictionary:</p>
  
  <pre><code>dictionary = {"hello": "foo", "world": "bar"}
  </code></pre>
  
  <p>how can I make it print "foo bar" when given an input "hello world"?</p>