Subset checking (A ⊆ B) Dry Run in PYTHON

Subset checking (A ⊆ B) 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.

Subset checking (A ⊆ B) Program Code

# Subset checking
A = {1, 2, 3}
B = {1, 2, 3, 4, 5}
C = {1, 2, 6}

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

# Method 1: issubset() method
print(f"\nA is subset of B: {A.issubset(B)}")
print(f"C is subset of B: {C.issubset(B)}")

# Method 2: <= operator
print(f"A <= B: {A <= B}")
print(f"C <= B: {C <= B}")

# Proper subset (strict) using <
print(f"\nA < B (proper subset): {A < B}")
print(f"A < A (proper subset?): {A < A}")

View the complete Sets programs page.

Program Console Subset checking (A ⊆ B) Topic: PYTHON Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.