title: How can i get the tuples to display the sum of each person rather than individually?
body: <p>So I have been given this dictionary whose keys are names; which has tuples with 3 values: in the 3-tuple,  a stock name, number of shares traded for that transaction (int), and price of each share (int). </p>
  
  <pre><code>new_dict = {
      'Carl': [('Intel', 30, 40), ('Dell' , 20, 50), ('Intel',-10, 60), 
  ('Apple', 20, 55)],
      'Barb': [('Intel', 20, 40), ('Intel',-10, 45), ('IBM',   40, 30), 
  ('Intel',-10, 35)],
      'Alan': [('Intel', 20, 10), ('Dell',  10, 50), ('Apple', 80, 80), ('Dell', 
  -10, 55)],
      'Dawn': [('Apple', 40, 80), ('Apple' ,40, 85), ('Apple',-40, 90)]
    }
  </code></pre>
  
  <p>I am creating a function that returns a list of 2-tuples as a result (client, and absolute value of number of shares they sold(negative num) or bought (positive num) total.
  <strong>- the list is sorted in decreasing order based on the sum of the number of shares they traded; if two clients trade the same number of shares, they must appear in increasing alphabetical order.</strong></p>
  
  <p>For new_dict as the dictionary, the output should be [('Alan', 120), ('Dawn', 120), ('Barb', 80), ('Carl', 80)]</p>
  
  <p>Here's what I have done:</p>
  
  <pre><code>def most_active_clients(database :{str: (str, int, int)}) -&gt; list:
          result = []
          t = list()
  
          for key,val in database.items():
              for x in val:
                  t.append((key,abs(x[1])))
                  for item in t:
                      print(item)
  </code></pre>
  
  <p>I can't seem to figure out how to get the sum of all x[1]'s and then sort that. Can someone help me?</p>