Python – Find Set – set() Function – Examples & Explanation

set() function is used to find the constructs a Python set from the given iterable and returns it in Python for the given input.

set() function is a part of Python Built-in Functions.

Syntax of set() Function

The syntax of set() function in Python is:

set([iterable])

 

Parameters of set() Function in Python

x – Where x is any valid . This parameter is required.

 

Compatibility

set() function is available and compatible with both Python 2.x and 3.x.

 

Return Value of set() Function in Python

set() function returns constructs a Python set from the given iterable and returns it for the given input.

 

Python set() Function Example 1

Example CODE

Output:

 

Python set() Function Example 2

Example CODE

Output: