title: Applying a function to values in dict
body: <p>I want to apply a function to all values in dict and store that in a separate dict. I am just trying to see how I can play with python and want to see how I can rewrite something like this</p>
  
  <pre><code>for i in d:
      d2[i] = f(d[i])
  </code></pre>
  
  <p>to something like </p>
  
  <pre><code>d2[i] = f(d[i]) for i in d
  </code></pre>
  
  <p>The first way of writing it is of course fine, but I am trying to figure how python syntax can be changed</p>