Program Console Vignaankosh.com
Execution Panel
Console is empty.
Create immutable set using frozenset is an interactive PYTHON dry run visualizer from the Sets programs section. Study the source code, then use the execution controls to follow each step, variable update, highlighted line, and console output.
This page provides a browser-based dry run with source-code highlighting, auto-scroll, voice narration controls, and execution output for learning the program step by step.
# Create immutable frozenset
normal_set = {1, 2, 3, 4, 5}
frozen = frozenset(normal_set)
print("Frozenset:", frozen)
print("Type:", type(frozen))
# Frozenset from list
frozen_from_list = frozenset([1, 2, 2, 3, 4])
print(f"\nFrom list: {frozen_from_list}")
# Frozenset from string
frozen_from_str = frozenset("hello")
print(f"From string: {frozen_from_str}")
# Cannot modify frozenset
try:
frozen.add(6)
except AttributeError as e:
print(f"\nCannot modify: {e}")
# Can be used as dictionary key
my_dict = {frozenset([1,2]): "value"}
print(f"\nUsed as dict key: {my_dict}")