Home › Forums › Batch of Feb 26, 2024 › frozenset › Reply To: frozenset
-
example :
fruits = {‘apple’, ‘banana’, ‘cherry’}
x = frozenset(fruits) #
x[1] = “strawberry” #Attempting to modify a frozenset will result in a TypeError# If you need to modify the set, we need to use a regular set instead
fruits.add(“strawberry”)
print(fruits)