Check whether two sets are equal Dry Run in PYTHON

Check whether two sets are equal 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.

Check whether two sets are equal Program Code

# Check if two sets are equal
set1 = {1, 2, 3, 4, 5}
set2 = {5, 4, 3, 2, 1}
set3 = {1, 2, 3, 4, 6}

print("set1 =", set1)
print("set2 =", set2)
print("set3 =", set3)

# Using == operator
print(f"\nset1 == set2: {set1 == set2}")
print(f"set1 == set3: {set1 == set3}")

# Using ^ (symmetric difference) - empty if equal
print(f"set1 ^ set2 (empty if equal): {set1 ^ set2}")
print(f"set1 ^ set3: {set1 ^ set3}")

View the complete Sets programs page.

Program Console Check whether two sets are equal Topic: PYTHON Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.