Skip to content
Advertisement

How to do a multi level sort on list of lists in Python? [duplicate]

I have the below code:

JavaScript

With this the output is:

JavaScript

I’m trying to display the names in Descending order while the values in Ascending order. Is there a pre built way in python to achieve this?

Expected output:

JavaScript

Advertisement

Answer

You changed the expected output, this would be the solution for that:

JavaScript

This was the answer before the question was edited and seperates the entries before sorting them:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement