Python Frozenset

Table of Contents

What is Frozenset in Python?

Python frozenset is an immutable variant of set.
Unlike set, you can not modify the values of the frozenset once assigned

 

How to create a Frozenset in Python

A frozenset type of objects can be created using built -in method frozenset().
There is no literal to create forzenset

list1 = [1, 2, 3, 4, 5]
fs = frozenset(list1) # takes any iterable like list "list1" here
print(type(fs))
print(fs)
<class 'frozenset'>
frozenset({1, 2, 3, 4, 5})

 

Click any Link
to navigate to certain page easily
Write a line to us
Your Email
Title
Description