Web Analytics

Python set() Function

Type Conversion Set

The set() function creates a set object. A set is a collection which is unordered, unchangeable*, and unindexed.

* Note: Set items are unchangeable, but you can remove items and add new items.

Syntax

set(iterable)

Parameters

Parameter Description
iterable Optional. A sequence, collection or an iterator object

Return Value

A set object.

Example

Using the set() function:

Output
Click Run to execute your code

Related Functions