jeapedu 129 集合的習題3

链接: https://pan.baidu.com/s/1eI0ybsXKhU3Zrow8u9fCPA 密码: sv26

# 3 find different item in two tuple
t1 = tuple("123456")
t2 = tuple("245689")
print(t1)
print(t2)
s1 = set(t1)
s2 = set(t2)
print(s1)
print(s2)
d12 = s1.difference(s2)
print(d12)
d21 = s2.difference(s1)
print(d21)
for x in d21:
    d12.add(x)
print(d12)

print(t1)
print(t2)
temp = []
for x in t1:
    if x not in t2:
        temp.append(x)
for x in t2:
    if x not in t1:
        temp.append(x)
print(temp)
t = tuple(temp)
print(t)

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

私密
私密原因:
请选择设置私密原因
  • 广告
  • 抄袭
  • 版权
  • 政治
  • 色情
  • 无意义
  • 其他
其他原因:
120
出错啦
系统繁忙,请稍后再试