Which Python data type represents an unordered collection of unique elements?
In Python, the set data type is specifically designed to store an unordered collection of unique, hashable items — duplicate values are automatically discarded, and elements have no defined order or index. This distinguishes it from list and tuple, which are ordered and allow duplicates, and from dictionary, which stores unique keys mapped to values rather than a simple collection of unique elements.
set
list
tuple
dictionary
Community Discussion