You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Definition: A set is a collection of unordered, unique, and immutable elements.
Characteristics:
Avoids duplicate elements.
Elements are immutable, but the set itself is mutable (can be modified after creation).
Written using curly braces{} or the set() function.
Examples and Set Operations
Creating a Set
collection= {1, 23, 4, 5, 6, 6, 0, "noushad"}
print(collection) # Duplicate elements are removedprint(type(collection))
print(len(collection)) # Total number of unique elements