Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

sort first element reverse sort second python

>>> sorted(lista, key=lambda x: (-x[0], x[1]))
[(485, 'Elizabeth'), (485, 'Matthew'), (390, 'Jayden'), (207, 'Natalie'), (144, 'Chloe'), (51, 'Elijah')]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #sort #element #reverse #sort #python
ADD COMMENT
Topic
Name
7+2 =