lst=[(5,1),(4,2),(1,2),(9,3),(8,3)] print sorted(lst, key=lambda x: (x[1], -x[0]))[-1]
Standard input is empty
(8, 3)
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!