I apologize of if this is a duplicate of this.
Sort a list of tuples depending on two elements depending-on-two-elements
What I have is a unsorted list of tuples
unsorted_list = [(50,45), (35,40)]
sorted_list = [(35,40), (50,45)]
I want to end up with the following sorted list. I tried the following:
sorted(unsorted, key=lambda element: (element[0], element[1]))
My result was the following, which is not what I wanted.
[(35, 40), (45,50)]