Order by word lenghts X30120


Statement
 

pdf   zip

Write a function @length_sorted(f)@ that provided a list of words ff returns a list gg with the very same words of ff. Words in gg must appear in increasing lengths. Words of the same length must appear in alpabetical order. All characters in words are lowercase letters.

Sample session

Sample session
>>> length_sorted(['z', 'ping', 'king', 'doork', 'koong', 'doong', 'x'])
['x', 'z', 'king', 'ping', 'doong', 'doork', 'koong']
>>> length_sorted(['winter', 'winner', 'counter', 'mother', 'table'])
['table', 'mother', 'winner', 'winter', 'counter']
>>> length_sorted(['self', 'made', 'man'])
['man', 'made', 'self']
>>> length_sorted(['z', 'y', 'x', ''])
['', 'x', 'y', 'z']
Information
Author
Language
English
Official solutions
Python
User solutions
Python