s1 = set([1, 2, 3, 4, 5])
s2 = set([1, 2, 3, 4, 5, 6, 7, 8, 9])
if s1.isdisjoint(s2) is True:
print('無重復集合')
else:
for a in s1:
if a in s2:
print(a)
s2 = set([1, 2, 3, 4, 5, 6, 7, 8, 9])
if s1.isdisjoint(s2) is True:
print('無重復集合')
else:
for a in s1:
if a in s2:
print(a)
2024-09-19
L = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
S = set([1, 3, 5, 7, 9, 11])
for a in L:
if a in S:
S.remove(a)
else:
S.add(a)
print(S)
S = set([1, 3, 5, 7, 9, 11])
for a in L:
if a in S:
S.remove(a)
else:
S.add(a)
print(S)
2024-09-19
a = 'python'
print('hello,', a or 'world')
b = ''
print('hello,', b or 'world') a = 'python'
print('hello,', a or 'world')
b = ''
print('hello,', b or 'world')
print('hello,', a or 'world')
b = ''
print('hello,', b or 'world') a = 'python'
print('hello,', a or 'world')
b = ''
print('hello,', b or 'world')
2024-08-28