Perform all set operations (demo) Dry Run in PYTHON

Perform all set operations (demo) 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.

Perform all set operations (demo) Program Code

# Perform all set operations
A = {100, 200, 300, 400}
B = {300, 400, 500, 600}

print("Set A:", A)
print("Set B:", B)
print()

# Union
print(f"Union (A ∪ B): {A | B}")

# Intersection
print(f"Intersection (A ∩ B): {A & B}")

# Difference
print(f"Difference (A - B): {A - B}")
print(f"Difference (B - A): {B - A}")

# Symmetric Difference
print(f"Symmetric Difference (A △ B): {A ^ B}")

# Subset/Superset
print(f"\nA ⊆ B: {A.issubset(B)}")
print(f"A ⊇ B: {A.issuperset(B)}")

# Disjoint
print(f"A and B are disjoint: {A.isdisjoint(B)}")

View the complete Sets programs page.

Program Console Perform all set operations (demo) Topic: PYTHON Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.