Why is this returning an empty list:
def word_lengths(phrase):
result = []
map(lambda x: result.append(x) , phrase.split())
return result
Where as this returns a list of the length of each word in the phrase:
def word_lengths(phrase):
return list(map(lambda x: len(x) , phrase.split()))