cmp() is deprecated because there is seldom reason to use it anymore.
Sorting words according to their number of letter is just:
If you want to rank participants of a game in a dictionary of scores using names as keys and points as values, you would to:
sorted(scores.items(), key=lambda score: score)
> If you really need the cmp() functionality, you could use the expression (a > b) - (a < b) as the equivalent for cmp(a, b)