Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Solution: count words (plain)

words = ['Wombat', 'Rhino', 'Sloth', 'Tarantula', 'Sloth', 'Rhino', 'Sloth']

counter = {}
for word in words:
   if word not in counter:
       counter[word] = 0
   counter[word] += 1

for word in counter:
   print("{}:{}".format(word, counter[word]))