title: Sorting Nested list in python
body: <p>I am doing a problem that my school has assigned to me.
  Here is code till now:</p>
  <pre><code>profits = [1,2,5,6]
  weights = [2,3,4,5]
  n = 8
  ratio = []
  count = 0
  for i in range(len(profits)):
      ratio.append([])
  for i in range(len(ratio)):
      ratio[i].append(weights[i])
      ratio[i].append(profits[i] / weights[i])
  </code></pre>
  <p>The output (ratio):</p>
  <pre><code>[[2, 0.5], [3, 0.6666666666666666], [4, 1.25], [5, 1.2]]
  </code></pre>
  <p>But the problem is that I want the list to be sorted maximum ratio wise
  like this:</p>
  <pre><code>[[4, 1.25], [5, 1.2], [3, 0.6666666666666666], [2, 0.5]]
  </code></pre>