fronzenset(my_iterable)
my_iterable : This is an iterable object like List, tuple, set
Output is unchangeable frozenset object. This object is immutable ( what is immutable ? ) my_list=[1,2,3]
my_list=frozenset(my_list)
print(my_list) # frozenset({1, 2, 3})
We will try to change one element
my_list=[1,2,3]
my_list=frozenset(my_list)
my_list[1]=8
print(my_list) # frozenset({1, 2, 3})
Above code will generate error saying my_tuple=(1,2,3)
my_tuple=frozenset(my_tuple)
my_tuple[1]=5
Above code will generate error sayingmy_tuple=(1,2,3)
my_tuple +=(4,5)
print(my_tuple)
my_tuple=frozenset(my_tuple)
my_tuple +=(6,7)
Above code will generate error saying Author
🎥 Join me live on YouTubePassionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and project‑oriented with real examples and source code.