title: How to find the second lowest lists into a nested list by their second value?
body: <p>Here is given a nested list:</p>
  
  <pre><code>nl = [['Harsh', 20], ['Beria', 20], ['Varun', 19], ['Kakunami', 19], ['Vikas', 21]]
  </code></pre>
  
  <p>Now I have to find the second lowest lists into the nested list by their second value. And append the second lowest lists into another list.</p>
  
  <p>So the output should be:</p>
  
  <pre><code>['Harsh', 20], ['Beria', 20]
  </code></pre>
  
  <p>I wrote the following code but it doesn't work:</p>
  
  <pre><code>nl = [['Harsh', 20], ['Beria', 20], ['Varun', 19], ['Kakunami', 19], ['Vikas', 21]]
  
  result=[]
  
  temp=max(nl, key=lambda x: x[1])
  
  largest, larger = temp[1], temp[1]
  for num in nl:
      if num[1] &lt; largest:
          largest, larger = num[1], largest
      elif num[1] &lt; larger:
          larger = num[1]
          result.append(larger)
  print(result)
  </code></pre>