Skip to content

Dictionaries · routine

Group words by length

Write group_by_length(words) returning a dictionary from each length to the list of words of that length, in their original order.

Run adds print(group_by_length(["a", "bb", "c"])) after your code, to try it.

Stuck on the idea rather than the code? The Grouping and nested data lesson walks through it.