Python set() Function
Instance
Create a set containing fruit names:
x = set(('apple', 'banana', 'cherry'))
Definition and Usage
The set() function creates a set object.
The items in the set list are unordered, so they will appear in a random order.
Please refer to the 'Python Collections' chapter for more information about collections.
Syntax
set(iterable)
Parameter Value
Parameters | Description |
---|---|
iterable | Required. A sequence, set, or iterator object. |