Count repeated words
Take your time, follow the code and check your understanding.
The codeDictionaries
words = "code learn code".split()
counts = {}
for word in words:
counts[word] = counts.get(word, 0) + 1
print(counts["code"])Your answer3 min · no timer
Show solution and explanation
get supplies zero on the first encounter. The word code appears twice.
2