Intersection and union of sets - Python
In Python, we can use sets (set) to implement the intersection and union operations of sets. A simple sample code is given below:
# 两个集合的定义
a = {
1, 2, 3}
b = {
2, 3, 4}
# 交集运算
c = a & b