Program Console Vignaankosh.com
Execution Panel
Console is empty.
Union of two sets 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.
# Union of two sets
A = {10, 15, 20}
B = {20, 25, 30}
print("Set A:", A)
print("Set B:", B)
# Method 1: | operator
union_operator = A | B
print(f"\nA | B: {union_operator}")
# Method 2: union() method
union_method = A.union(B)
print(f"A.union(B): {union_method}")
# Method 3: Multiple sets
C = {30, 35, 40}
union_all = A.union(B, C)
print(f"A ∪ B ∪ C: {union_all}")
# Method 4: Using update
A_copy = A.copy()
A_copy.update(B)
print(f"Using update (modifies copy): {A_copy}")