Sets and Set Mathematics

Scenario: Two deployment lists contain duplicates and you need common and missing services.

New words, in plain English

Create sets with {...} or set(iterable); the empty set is set(). Use |, &, -, and ^, plus add, discard, and fast membership tests.

Analogy: A Python program is like a clear set of instructions for a careful helper: names label things, indentation groups steps, and errors explain where the helper became confused.

A small, real example

wanted = {"api", "db", "cache"}
running = {"api", "cache"}
print(wanted - running)  # {'db'}
Tip: Sets have no stable positional index. Sort them when display order matters.
Goal: Practice this idea in the py-tuples-sets challenge at /labs/python. Fix the broken program, run it yourself, then use check to prove the real end state.