Tutorial
Sets in Python
Sets in Python are collections of unique items. They are unordered, mutable, and useful when you want to store non-duplicate elements.
Creating a Set
Adding Items
Removing Items
Set Operations
Summary
- Sets store unique elements only
- Items in a set are unordered
add(item)– Adds an itemremove(item)– Removes an item- Common set operations:
union,intersection,difference