set()

Built-in FunctionPython 2.4+Beginner

Creates a new mutable set of unique elements

Quick Info

Documentation
Official Docs
Python Version
2.4+

Learn by Difficulty

Quick Example

python
s = set([1, 2, 2, 3, 3, 3])
print(s)
s2 = set("hello")
print(s2)

set() is a built-in function that creates a new mutable set of unique elements.

Try in Playground

Tags

builtinfunctioncoredatatypecollectionmutableunique

Related Items