If I have a list of tuples, where the first is number, and second is a string, for example:
[(2, 'eye'), (4, 'tail'), (1, 'scarf'), (4,'voice')]
How can I sort it in descending order by the number and If there is a tie in number at any point, the words with the same number should be sub-sorted alphabetically. And return the final sorted words.
From my example:
['tail', 'voice', 'eye', scarf']
I sorted them by descending order, but I don't know how to subsort it alphabetically. Will be happy to hear any hint and answer. Thanks!
def sorting(list)
my_list = []
for x, y in list.items():
my_list+=[(y,x)]
sort=sorted(my_list, reverse=True)