title: Python check if an item is in a nested list at a certain index
body: <p>I generated a nested list of unique pairs, where each item exists in two pairs.</p>
  
  <pre><code>my_list = [['item1', 'item2'],
             ['item3', 'item4'],
             ['item5', 'item6'],
             ['item7', 'item8'],
             ['item1', 'item9'],
             ['item3', 'item10'],
             ['item5', 'item11'],
             ['item7', 'item12'],
             ['item13', 'item2'],
             ['item14', 'item4'],
             ['item15', 'item6'],
             ['item16', 'item8'],
             ['item13', 'item9'],
             ['item14', 'item10'],
             ['item15', 'item11'],
             ['item16', 'item12']]
  </code></pre>
  
  <p>But the requirement is that each item needs to exist at each index only once. So item1 for example should show up at index 0 of the sublist once and index 1 of the sublist the second time it shows up in a pair or vice versa.</p>
  
  <p>I tried using any() with a conditional to check if the item exists in the nested list, but can't figure out how to check if it exists at an index in the sublist already, in which case I would reverse the nested list.</p>
  
  <pre><code>for pair in my_list:
      if any(item in sublist for sublist in my_list):
          pair.reverse()
  </code></pre>