Intersection and union of sets - Python

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  

Guess you like

Origin blog.csdn.net/update7/article/details/131670269