title: Loop through list of tuples and unpack elements of each tuple
body: <p>I have this list of two-value tuples</p>
  <pre><code>stake_odds=[(0, 1), (0, 2), (0, 5), (0, 10), (2, 1), (2, 2), **(2, 5)**, (2, 10), (5, 1), (5, 2), (5, 5), (5, 10), (10, 1), (10, 2), (10, 5), (10, 10)]
  </code></pre>
  <p>I have the following function where I want to put the tuple into an object method where it calculates the product (or minus product depending on the instance) of the two numbers in the tuple. If the product is positive, I want to append the tuple used to another list, <code>pos_cases</code>.</p>
  <pre><code>def function():
      pos_cases=[]
      x,y=stake_odds[9]
      b1=bet1.payout(x,y)
      if b1 &gt; 0:
          return b1, &quot;b is greater than zero!&quot;
          pos_cases.append(stake_odds[9])
          print(pos_cases)
  
  print(function())
  </code></pre>
  <p>As you can see below I have to unpack the tuple into two variables before computing. I can do it by specifying the element of the list (<code>stake_odds[9]</code>), however I am looking for a way to generalize and loop through the list (<code>stake_odds[i]</code>) rather than going one by one.</p>
  <p>The list in this example would be shortened to the following:</p>
  <pre><code>pos_cases =[(2, 1), (2, 2), (2, 5), (2, 10), (5, 1), (5, 2), (5, 5), (5, 10), (10, 1), (10, 2), (10, 5), (10, 10)]
  </code></pre>
  <p>How could I do this? The only thing I can think of is some nested for loop like:</p>
  <pre><code>for i in stake_odds: 
      for x,y in i:
          return(x,y)
  </code></pre>
  <p>But this results in <code>error &gt;TypeError: cannot unpack non-iterable int object&gt;</code>.</p>