Complete the comprehension
# returns a dict mapping each word to its length
def lengths(words):
return {w: ____ for w in words}
# lengths(["a","bb"]) -> {"a":1,"bb":2}
Answer: len(w)
len(w) gives the length of each individual word.
Play Problem Solving ▸