Sorting based on max length and max sum
<p>Can you please help me figure this out</p>

<pre><code>q = [[12, 13, 14], [8, 9, 10,11], [2, 3, 4], [5, 6, 7]]
</code></pre>

<p>suppose I've a list like q, How do I sort the based on </p>

<ol>
<li>Max length of sublists and  </li>
<li>Max sum of the sublists</li>
</ol>

<p>The output should be:</p>

<pre><code>q = [[8,9,10,11],[12,13,14][5,6,7],[1,2,3]]
</code></pre>

<p>Try:</p>

<pre><code>sorted(q, lambda a,b: len(b)-len(a) or sum(b)-sum(a))
</code></pre>

python list sorting