9 lines
206 B
Python
9 lines
206 B
Python
A = {1, 2, 3}
|
|
B = {3, 4, 5}
|
|
print(B.union(B)) # 并集
|
|
print(A.intersection(B)) # 交集
|
|
print(A.difference(B)) # 在 A 不在 B
|
|
print(A.symmetric_difference(B)) # 在 A 或 B 但不同时在两者中
|
|
|
|
|