Exercise 3 solution def group_by_first_letter(words): groups = {} for w in words: groups.setdefault(w[0], []).append(w) return groups print(group_by_first_letter(["apple", "avocado", "banana", "blueberry", "cherry"])) mon = {"ann", "bob", "cy"} tue = {"bob", "dee"} print(sorted(mon | tue)) print(sorted(mon & tue)) print(sorted(mon - tue)) print(sorted(mon ^ tue)) Output: {'a': ['apple', 'avocado'], 'b': ['banana', 'blueberry'], 'c': ['cherry']} ['ann', 'bob', 'cy', 'dee'] ['bob'] ['ann', 'cy'] ['ann', 'cy', 'dee'] setdefault(key, []) returns the existing list for the key, or stores and returns a new empty one, so each word can be appended in a single line. sorted() is used on the sets because a set has no reliable order.