Group items by some property:
words = ["apple", "ant", "bear", "bee", "cat"]
by_first_letter = {}
for word in words:
first = word[0]
if first not in by_first_letter:
by_first_letter[first] = []
by_first_letter[first].append(word)
# {"a": ["apple", "ant"], "b": ["bear", "bee"], "c": ["cat"]}
With setdefault():
for word in words:
by_first_letter.setdefault(word[0], []).append(word)