I am using the Python sorted function in order to sort a multidimensional list which has many entries.
Example:
sorted_list = sorted(list_not_sorted, key=lambda x:x[1], reverse=True)
Is there a way to sort it based on the size of the numbers?
Lets say I have the following list:
[
[John,973],
[Jim,99],
[Jason,912345]
]
Using that code will sort it like this:
[
[Jim,99],
[John,973]
[Jason,912345],
]
However I want it sorted like this:
[
[Jason,912345],
[John,973]
[Jim,99],
]
Is there any way to do this with this function?
Question has been edited for clarity!