![]() | 1 | initial version |
Lexicographic order is the default one for tuples. So, you can simply use sorted()
function or .sort()
method on your list of tuples:
sage: L = [(1,2,3), (1,1,5), (1,3,5), (1,6,7), (8,7,3)]
sage: print( sorted(L) )
[(1, 1, 5), (1, 2, 3), (1, 3, 5), (1, 6, 7), (8, 7, 3)]