Here is my code: i used set() and it return [3, 14, 6]
items = [3, 6, 3, 3, 14]
set(items)
>>> set([3,14,6])
My question is how is
Sets are unordered. From the documentation:
Being an unordered collection, sets do not record element position or order of insertion.
Like dictionaries, the ordering is based on the hashes of the stored keys. You cannot rely on this apparent ordering to remain stable.
If you are interested in the underlying data model, the underlying data structure is called a Hash Table, but in sets only keys are stored, values are left empty.