Frozenset
A frozenset is an immutable set of unique hashable elements. It is useful when a set itself needs to be a dictionary key or part of another set.
Understand the idea
Membership and non-mutating set operations remain available. There are no add, remove, or update mutation methods. Two frozensets containing equal elements compare equal regardless of insertion history. Their use should represent an unordered combination, not a sequence whose positions matter.
Where to try it
Open this example with Try in playground. The code loads as editable text and does not run until you select Run. The first run downloads Python. Each run starts fresh; temporary files created by a script are not files on your PC.
A worked example
pair = frozenset({"html", "css"})
prices = {pair: 1500}
print(prices[frozenset({"css", "html"})])
Read the result
The lookup returns 1500 because the two immutable sets describe the same combination.
Try one change
Use two frozensets as keys for different course bundles and decide whether order should have mattered.