title: Sort list according to elements in sublist
body: <p>I have a simple list composed of several sublists like so:</p>
  
  <pre><code>a = [[4, 3, 2, 1], [5, 8, 7, 6], [12, 11, 10, 9]]
  </code></pre>
  
  <p>I need to sort this according to the elements in the sublist <code>a[1]</code> in descending order so it will like like this:</p>
  
  <pre><code>sorted_a = [(3, 2, 1, 4), (8, 7, 6, 5), (11, 10, 9, 12)]
  </code></pre>
  
  <p>I've tried using sorted:</p>
  
  <pre><code>sorted_a = sorted(a, key=lambda x: -x[2])
  </code></pre>
  
  <p>but it returns:</p>
  
  <pre><code>[[12, 11, 10, 9], [5, 8, 7, 6], [4, 3, 2, 1]]
  </code></pre>
  
  <p>which is not what I need at all.</p>