Python frozenset() Syntax
Syntax : frozenset(iterable_object_name)
Parameter : iterable_object_name
- This function accepts iterable object as input parameter.
Return : Returns an equivalent frozenset object.
frozenset() in Python
Python Method creates an immutable Set object from an iterable. It is a built-in Python function. As it is a set object, therefore, we cannot have duplicate values in the frozenset.
Example
In this example, we are creating a frozen set with the list in Python.
Python3
animals = frozenset ([ "cat" , "dog" , "lion" ]) print ( "cat" in animals) print ( "elephant" in animals) |
Output
True
False