2020年5月22日 星期五

python set 集合

s1 = {-3,-2,-1,0,1,2,3,4,5}
s2 = {1,2,3,4,5,6,7,8}
print("交集",s1 & s2)
print("聯集",s1 | s2)
print("差集",s1 - s2)

沒有留言:

張貼留言