+ 1
How do I sort a 2d list
I want to sort a 2d list according to its column element, however if some column elements are equal, I'd like them to be sorted in ascending order by the line element. For instance: 1st line is the number of lines for the list The others are the elements that will be in the list Input: 4 5 10 6 3 7 3 15 10 Output: 6 3 7 3 5 10 15 10 However I get 7 3 before 6 3 which is a problem. I use itemgetter to compare the column. Thank you so much for your time!
1 Answer
+ 4
Uses a lambda as sort function for `sorted` function
https://code.sololearn.com/cMqNIQLB1A3T/?ref=app