Using Sets for Unique Collections and Operations in Python


Perform mathematical set operations like union and intersection.

Source Code

a = {1, 2, 3}
b = {3, 4, 5}
print(a | b)  # Union
print(a & b)  # Intersection
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments