How to sort a list by length and then in reverse alphabetical order
Just use the reversed
function:
a = list(reversed(sorted(a, key=lambda x: (-len(x), x))))
In [301]: a
Out[301]: ['b', 'a', 'zzz', 'ddd', 'ccc']