set中11怎么不见了
L = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
S = set([1, 3, 5, 7, 9]) for item in L: if item in S: S.remove(item) else:SET S.add(item) print(S) # ==> set([2, 4, 6, 8, 10])
set输出2,4,6,8,10,其中11怎么不见了
L = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
S = set([1, 3, 5, 7, 9]) for item in L: if item in S: S.remove(item) else:SET S.add(item) print(S) # ==> set([2, 4, 6, 8, 10])
set输出2,4,6,8,10,其中11怎么不见了
2021-03-28
举报