Sorted Lengths X80397


Statement
 

pdf   zip   main.py

thehtml

Write a function sortlengths(words) that receives a list of strings and returns an ordered list with the lengths of these strings.

Sample session
>>> sortlengths([])
[]
>>> sortlengths(["Don't", 'pull', 'my', 'leg!'])
[2, 4, 4, 5]
>>> sortlengths('I saw that island first when it was neither night nor morning.'.split())
[1, 2, 3, 3, 3, 4, 4, 5, 5, 6, 7, 8]
>>> sortlengths(['', '1;2', ''])
[0, 0, 3]
Information
Author
José Luis Balcázar
Language
English
Official solutions
Python
User solutions
Python