I have a list with sublists as follows:
result = [ ['helo', 10], ['bye', 50], ['yeah', 5], ['candy',30] ]
I want to sort this with three conditions: first, by highrest integer in index 2 of sublist, then by length of word in index 1 of sublist, and finally by alphabetical order in the 1st index of sublist.
I tried to do the following but it does not work:
finalresult = sorted(result, key=lambda word: (-word[1], len(word), word[0]))
This sorts it by the highest integer and alphabet order but not by length of word.
Any help is appreciated. Thank You.