Program Console Vignaankosh.com
Execution Panel
Console is empty.
Intersection 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.
# Intersection of two sets
A = {1, 2, 3, 4, 5, 6}
B = {4, 5, 6, 7, 8, 9}
C = {5, 6, 10, 11}
print("Set A:", A)
print("Set B:", B)
print("Set C:", C)
# Method 1: & operator
intersection = A & B
print(f"\nA & B: {intersection}")
# Method 2: intersection() method
intersection_method = A.intersection(B)
print(f"A.intersection(B): {intersection_method}")
# Method 3: Multiple sets
intersection_all = A.intersection(B, C)
print(f"A ∩ B ∩ C: {intersection_all}")
# Method 4: Using intersection_update
A_copy = A.copy()
A_copy.intersection_update(B)
print(f"Using intersection_update: {A_copy}")