$ ./guess_the_languageProblem Solving — fill the blank
Problem Solving — fill the blank · medium · #114

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) (also accepted: len(w))

len(w) gives the length of each individual word.
Play Problem Solving ▸