It is exactly same as set except that it is immutable. ֍ Hence we cannot use add or remove functions. 1) >>> s={10,20,30,40} 2) >>> fs=frozenset(s) 3) >>> type(fs) 4) 5) >>> fs 6) frozenset({40, 10, 20, 30}) 7) >>> for i in fs:print(i) 8) ... 9) 40 10) 10 11) 20 12) 30 13) 14) >>> fs.add(70) 15) AttributeError:
Popularity
3/10 Helpfulness
1/10
Language whatever
Register to vote on and add code examples. Join our developer community to improve your dev skills and code like a boss!
No Good?
Help us improve our code examples by registering to vote on and add answers. Join our developer community to improve your dev skills and code like a boss!