Python Set() function
Published February 16, 2022The set() function converts an iterable to a sequence of iterable items containing distinct elements, which is known as a Set.
Syntax of set() Function
The set() method is written as follows
Set(iterable) |
Where, the iterable can comprise a dictionary, a list or a turple
Example
x = { 3 : 'I', 2 : 'Love', 1 : 'Python' } |
Output
Before coversion : {3: 'I', 2: 'Love', 1: 'Python'} |
Article Contributed By :
|
|
|
|
247 Views |