python sort by value first then key lexicography code example
Example: python sort by value first then key lexicography
>>> d = {'T': 1500, 'L': 1000, 'P': 1500, 'G': 6500, 'B': 7000}
>>> sorted(sorted(d), key=d.get, reverse=True)
['B', 'G', 'P', 'T', 'L']