Freeze the list, and make it unchangeable:
mylist = ['apple', 'banana', 'cherry']
x = frozenset(mylist)
The frozenset()
function returns an unchangeable frozenset object (which is like a set
object, only unchangeable).
Try to change the value of a frozenset item.
This will cause an error:
mylist = ['apple', 'banana', 'cherry']
x = frozenset(mylist)
x[1] = "strawberry"
Track your progress - it's free!
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4