It is same as set except that is is immutable.
So, we cannot use add or remove functions.
- 1.>>>a={5,10,15,20}
- >>>fs=frozenset(a)
- >>>type(fs)
- <class ‘frozenset’>
- >>>fs
- frozenset({20,10,5,15})
- >>>for i in fs:print(i)
- ……….
- 20
- 10
- 5
- 15
- >>>fs.add(70)
- AttributeError: ‘frozenset’ object has no attribute ‘add’
- >>>fs.remove(10)
- AttributeError:’frozenset’ object has no attribute remove,