Closed HananRosenthal closed 8 years ago
yes, but still need to extract all words belonging to a specific key. How would you do that without another list comprehension?
You go over the words one by one and on each turn you add the word to the list of the respective key. There is only one "loop" in this sentence.
You already have the key in hand when you call
k = f(word)
. Use that as the key in the dict.