Collections and Strings

Dictionaries, sets, tuples, and the string methods that do the boring parts. The types you need once a program stops holding a single value.

Articles

1

Python Dictionaries: the Key That Isn't There

A word counter dies the first time it meets a word twice. The fix is one line; what takes longer is knowing which of a dict's three lookups to reach for.

2

Python Sets: the Duplicate That Keeps Coming Back

A de-duplication loop that works on clean data leaves four tags where there should be two. The bug is case, and the fix is a set.

3

Python Tuples: Why All Three Points Are the Same Point

Three points walk into a loop and come out identical. The list was never copied three times; the name was. A tuple makes that bug impossible.

© 2026 Inva.dev.