I want to get a list of keys sorted by its values and in case of any ties, sorted alphabetically. I'm able to sort by values. In case of ties, I'm facing issues.
for dictionary:
aDict = {'a':8, 'one' : 1, 'two' : 1, 'three':2, 'c':6,'four':2,'five':1}
I've tried this:
sorted(aDict, key=aDict.get, reverse=True)
which gives me:
['a', 'c', 'three', 'four', 'two', 'five', 'one']
but I want:
['a', 'c', 'four', 'three', 'five', 'one', 'two']