I\'m trying to return words that have a specific length size.
The words is a list and size is a positive integer here. The result should be
words
size
I would use a list comprehension:
def by_size(words, size): return [word for word in words if len(word) == size]