<jupyter_start><jupyter_text>FrozensetThe frozenset() function returns an unchangeable frozenset object (which is like a set object, only unchangeable).<jupyter_code>mylist = ['apple', 'banana', 'cherry']
x = frozenset(mylist)
print(x)
# Try to change the value of a frozenset item.

#This will cause an error:

mylist = ['apple', 'banana', 'cherry']
x = frozenset(mylist)
x[1] = "strawberry"
help(frozenset)
A = frozenset([1, 2, 3, 4])
B = frozenset([3, 4, 5, 6])
C = frozenset([5, 6])<jupyter_output><empty_output><jupyter_text>Copy<jupyter_code>C = A.copy()  # Output: frozenset({1, 2, 3, 4})
print(C)<jupyter_output>frozenset({1, 2, 3, 4})<jupyter_text>Difference<jupyter_code>print(A.difference(B))  # Output: frozenset({1, 2})<jupyter_output>frozenset({1, 2})<jupyter_text>Intersection<jupyter_code>print(A.intersection(B))  # Output: frozenset({3, 4})<jupyter_output>frozenset({3, 4})<jupyter_text>isdisjoint<jupyter_code>print(A.isdisjoint(C))  # Output: True<jupyter_output>True<jupyter_text>issubset<jupyter_code>print(C.issubset(B))  # Output: True<jupyter_output>True<jupyter_text>issuperset<jupyter_code>print(B.issuperset(C))  # Output: True<jupyter_output>True<jupyter_text>Symmetric Difference<jupyter_code>print(A.symmetric_difference(B))  # Output: frozenset({1, 2, 5, 6})<jupyter_output>frozenset({1, 2, 5, 6})<jupyter_text>Union<jupyter_code>print(A.union(B))  # Output: frozenset({1, 2, 3, 4, 5, 6})<jupyter_output>frozenset({1, 2, 3, 4, 5, 6})
{'fraction_non_alphanumeric': 0.17064846416382254, 'fraction_numerical': 0.032081911262798635, 'mean_word_length': 9.397163120567376, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '9', 'dir': 'jupyter-structured-clean-dedup', 'id': '191359', 'license': 'Apache-2.0', 'n_tokens_mistral': 683, 'n_tokens_neox': 645, 'n_words': 103, 'path': 'Python Datatype-Frozenset.ipynb', 'repo_name': 'himanshu-1205/Python-Tutorial', 'size': '1465'}