What is the Python equivalent to C# LINQ Sum()
<p>In C# I can get the sum of some values like so:</p>

<pre><code>new List&lt;Tuple&lt;string, int&gt;&gt;().Sum(x =&gt; x.Item2);
</code></pre>

<p>How can I achieve the same result in Python? Assuming I have a list of tuples</p>

<p>The equivalent is a <a href="http://www.secnetix.de/olli/Python/list_comprehensions.hawk" rel="nofollow">comprehension</a> inside a <a href="https://docs.python.org/2/library/functions.html#sum" rel="nofollow"><code>sum()</code></a>.</p>

<pre><code>sum(x[1] for x in tuples)
</code></pre>

<p>For example, we can define some sample random data.</p>

<pre><code>from random import randint

r = lambda: randint(0, 100)

data = [(r(), r(), r()) for x in range(100)]

sum(x[1] for x in data)
</code></pre>

c# python