Increment value of integer in Python dictionary
<p>So I write an app that counts amount of yellow cards in football matches through all the games of the tournament.
So let's say I count all Brazil's goals and I need to increment the amount of yellow cards with each game I go through in a loop.
So I have this dictionary cards_per_team_dictionary that looks like this:</p>

<pre><code>['Brazil', 0]
</code></pre>

<p>and I wan't to increment the int value with each game. 
I tried the following but it doesn't seem to work:</p>

<pre><code>def add_yellow_cards_per_team(team_name, cards_num):
    cards_per_team_dictionary[team_name] += cards_num
</code></pre>

<p>I get an error:</p>

<pre><code>cards_per_team_dictionary[team_name] += cards_num TypeError: 'set' object is not subscriptable 
</code></pre>

<p>And also this:</p>

<pre><code>def add_yellow_cards_per_team(team_name, cards_num):
    cards_per_team_dictionary[team_name] + cards_num
</code></pre>

<p>But it seems to overrun the previous integer instead of adding up to it.
Thanks in advance!</p>