为什么伙会输出第一个和第三个
s = set(['Adam', 'Lisa', 'Paul'])
L = ['Adam', 'Lisa', 'Bart', 'Paul']
for a in L:
for b in s:
if a==b:
s.remove(a)
break
else:
s.add(a)
break
print s
s = set(['Adam', 'Lisa', 'Paul'])
L = ['Adam', 'Lisa', 'Bart', 'Paul']
for a in L:
for b in s:
if a==b:
s.remove(a)
break
else:
s.add(a)
break
print s
2019-06-01
举报