set
A collection of unique (duplicate-free) values.
Syntax
name = {a, b, c}Description
A set holds each value once; it drops duplicates automatically. It's unordered and not indexed. Elements are added with add().
Returns
A set object.
Example
Loading editor…
Expected output
2 True
When to use?
Removing duplicates, checking 'have I seen this value before'.