title: Find a second largest number in a Python list
body: <p>I was trying to find the second largest number in a list and thought of converting list into set, and to convert it back to list to eliminate the repeated values. Unfortunately, the negative value took the last index of the set (where I expected the greatest value to occupy the last index in the set). List contains both negative and positive values. When it was converted to set, the negative value took the last index.</p>
  
  <pre class="lang-py prettyprint-override"><code>n = 5
  arr = [57, 57, 57, -57, 57]
  
  res = list(set(arr))
  print(res[-2])
  </code></pre>
  
  <p>I expected this to be my output:</p>
  
  <pre><code>-57
  </code></pre>
  
  <p>but the one I got was:</p>
  
  <pre><code>57
  </code></pre>
  
  <p>How do I find the second largest number in a list?</p>