Sometimes a group needs all of its entries, rather than a single total. Give each new group its own empty list.
Start two independent packing lists.
crates = {}
crates.setdefault("fragile", []).append("cup")
crates.setdefault("books", []).append("atlas")
crates.setdefault("fragile", []).append("vase")
print(crates) # {'fragile': ['cup', 'vase'], 'books': ['atlas']}The first call for fragile creates its list. The second call for that key retrieves the existing list, so the cup stays there when the vase is added.
Complete boardings(riders). Each record supplies a stop and a name. Collect the names for every stop in arrival order, including repeated names. Empty input should return an empty dictionary.