jeapedu 126 集合的函數

链接: https://pan.baidu.com/s/1FNEt6ibJz3SOK_cZDPo-2w 密码: twrb

ss = {1, 4, 6, 8}
print(ss, type(ss))
ss = {1, 4, 6, 8, 1, 3, 6, 4}
print(ss, type(ss))
#print(ss[1])                   # 不支持索引
print(help(set))
li1 = range(3, 10)
li2 = range(7, 14)
set1 = set(li1)
set2 = set(li2)
print(set1, set2)
print(set1.intersection(set2))
print(set2.intersection(set1))
print(set1.union(set2))
print(set1.difference(set2))
print(set2.difference(set1))
阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页