title: Getting elements from a table and counting total
body: <p>I have a table as such representing the result of a game.</p>
  
  <pre><code>GameTab = [['TRE','ARD','1','1'],['PRK','GEA','2','3'],['ARD','PRK','1','0'],['TRE','GEA','2','1']]
  </code></pre>
  
  <p>I appended the result from a text file into table form so here's the text format: To put it easier, it's interpreted in such that for example, TRE scored 1 and ARD scored 1. PRK scored 2 and GEA score 3.</p>
  
  <pre><code>TRE:ARD:1:1
  PRK:GEA:2:3
  ARD:PRK:1:0
  TRE:GEA:2:1
  </code></pre>
  
  <p>Instead of obtaining the result for the player, i want to obtain the result of the opponent instead. I have done my code in a way where it obtains the result of the player but i couldn't think of a way to obtain the opponents result. </p>
  
  <p>For example, in the match of PRK:GEA and TRE:GEA:</p>
  
  <pre><code>The opponent of GEA scored a total of: 4
  </code></pre>
  
  <p>My code:</p>
  
  <pre><code>gameTab =[['TRE','ARD','1','1'],['PRK','GEA','2','3'],['ARD','PRK','1','0'],
            ['TRE','GEA','2','1']]
  
  dictionary = {}
  for i in gameTab:
      for c in range(len(i[:2])):
          if i[:2][c] not in dictionary.keys():
                 dictionary[i[:2][c]] = int(i[2:][c])
          else:
              dictionary[i[:2][c]] += int(i[2:][c])
  print(dictionary)
  </code></pre>