The Python data structure that represents an unordered collection of unique elements is a set. A set automatically eliminates duplicate values, making it useful for membership tests, removing repeated items, and mathematical operations such as union and intersection.
Sets are written with braces when they contain values, as in {"red", "blue"}. The expression {"red", "red", "blue"} produces a set containing only two elements. An empty set must be created with set(), because {} creates an empty dictionary instead. Set elements must be hashable, so mutable objects such as lists cannot be placed directly inside a set.
In modern Python, sets should not be treated as ordered sequences. Their iteration order is not a reliable part of the set’s meaning, and code should not depend on it. This distinguishes a set from a list, which preserves sequence order and permits duplicates, and from a tuple, which is ordered and immutable. A dictionary stores key-value pairs rather than only unique standalone elements.