ReferenceBuilt-in functions
set()
An unordered collection with no duplicates. The only way to write an empty one.
Signature
set(iterable=())Parameters
| Name | Means |
|---|---|
iterable | what to collect from |
Returns
A new set.
Example
Python
print(sorted(set([1, 2, 2, 3])))
print(len(set("aabbc")))
print(type(set()).__name__, type({}).__name__)Output
[1, 2, 3] 3 set dict