title: How can I change keys in a dictionary to upper case and add values of the same key in the resulting dictionary?
body: <p>I have a dictionary that looks like this:</p>
  
  <pre><code>d = {'A':110, 'a':100, 'T':50, 't':5}
  </code></pre>
  
  <p>I want to change the keys to upper case and combine <code>A+a</code> and <code>T+t</code> and add their values, so that the resulting dictionary looks like this:</p>
  
  <pre><code>d = {'A': 210, T: 55}
  </code></pre>
  
  <p>This is what I tried:</p>
  
  <pre><code>for k, v in d.items():
      k.upper(), v
  </code></pre>
  
  <p>and the result is:</p>
  
  <pre><code>('A', 110)
  ('A', 100)
  ('T', 50)
  ('t', 5)
  </code></pre>
  
  <p>I looks like tuples but I want to change it in the dictionary, so I tried to write a function:</p>
  
  <pre><code>def Upper(d):
      for k, v in d.items:
          k.upper(), v
      return d
  </code></pre>
  
  <p>but it returns the dictionary unchanged.</p>
  
  <p>After I have changed the keys to upper case I had found this solution to how to add values of keys in a dictionary:</p>
  
  <pre><code>dict([(x, a[x] + b[x]) if (x in a and x in b) else (x, a[x]) if (x in a) else (x, b[x])
  </code></pre>
  
  <p>but first I need to get the keys to upper case!</p>