title: Intersection and Difference of two dictionaries
body: <p>Given two dictionaries, I want to look at their intersction and difference and perform f function on the elements that intersect and perform g on the unique elements, Here's how I found out what the unique and intersecting elements are where d1 and d2 are two dictionaries, How do i print out the d_intersection and d_difference as dictionaries inside a tuple?  The output should look something like this ({intersecting keys,values}, {difference keys,values})
  for example: given </p>
  
  <pre><code>d1 = {1:30, 2:20, 3:30, 5:80}
  
  d2 = {1:40, 2:50, 3:60, 4:70, 6:90}
  </code></pre>
  
  <p>The output should be <code>({1: 70, 2: 70, 3: 90}, {4: 70, 5: 80, 6: 90})</code></p>
  
  <pre><code>dic = {}
  d_intersect = set(d1) &amp; set(d2)
  d_difference =  set(d1) ^ set(d2)
  for i in d_intersect:
      dic.update({i : f(d1[i],d2[i])})
  for j in d_difference:
      dic.update({j : g(d1[j],d2[j])})
  </code></pre>
  
  <p>Can someone tell me where I was going wrong and why does my code give key error 4?</p>