🐍

Python Sets

An animated visual guide — no boring text walls, just motion and logic.

✦ Unique values ✦ Unordered ✦ No duplicates ✦ Union · Intersection · Difference
Creating a Set — Duplicate Rejection
Watch what happens when duplicates try to sneak in
my_set
values will appear here…
my_set = set()
Sets Are Unordered
The same values — but Python decides where they live
my_set
Sets have no guaranteed order — positions are meaningless
print(my_set) → {3, 1, 4, 2, 5}  ←  could be anything!
Adding Elements
Try adding something new — then try adding a duplicate
my_set
my_set.add( ? )
Removing Elements
Click any bubble to remove it from the set
my_set
Click a value to call my_set.discard(value)
my_set.discard( ? )
Set Operations
Watch the math happen visually
Set A
A
Set B
B
↑ Pick an operation
result