Reply To: frozenset

  • POOJA BABAR

    Member
    February 29, 2024 at 2:56 pm

    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)

Get In Touch