title: Counting the number of wins for teams in a nested list
body: <p>I have written some code that I'm trying to use in order to calculate how many times a football team have won a match. The matches are placed into a nested list where each sub list contains the names of two teams and their scores for the game respectively. </p>
  
  <pre><code>L = [['Patriots', 'Giants', '3', '1'], ['Steelers', 'Patriots', '1', 2'], ['Giants', 'Steelers', '3', '5']]
  </code></pre>
  
  <p>However the list is much larger and contains more football teams who played in matches. </p>
  
  <p>I already have a final List which contains the name of each team and also the number of games they have played, which I calculated successfully. </p>
  
  <pre><code>finalList = [['Patriots', 7], ['Giants', 3], ['Steelers', 8]]
  </code></pre>
  
  <p>I want the output to be like this:</p>
  
  <pre><code>finalList = [['Patriots', 7, 2], ['Giants', 3, 0], ['Steelers', 8, 1]]
  </code></pre>
  
  <p>because the Patriots played 7 games and won two games, Giants played 3 games and won zero games and Steelers played 8 games and won one game.</p>
  
  <p>This is my code so far, which doesn't give me the correct results for some of the matches. It also does not sum the counts so it just appends a number of 1's and 0's like this:</p>
  
  <pre><code>[['Giants', 5, 1, 0, 1]]
  </code></pre>
  
  <p>My code:</p>
  
  <pre><code>for i in L:
      countLeft = 0
      countRight = 0
      if i[2]&gt;i[3]:
          countLeft += 1
      elif i[3]&gt;i[2]:
          countRight += 1
          for k in finalList:
              if i[0]==k[0]:
                  k.append(countLeft)
              elif i[1]==k[0]:
                  k.append(countRight)
  print(finalList)
  </code></pre>
  
  <p>I am also not allowed to use any dictionaries in my code!!</p>