为什么这个运行是错误的
s = set(['Adam', 'Lisa', 'Paul'])
L = ['Adam', 'Lisa', 'Bart', 'Paul']
for name in L:
for y in L:
if name == y :
s.remove(name)
else :
s.add(name)
print s
s = set(['Adam', 'Lisa', 'Paul'])
L = ['Adam', 'Lisa', 'Bart', 'Paul']
for name in L:
for y in L:
if name == y :
s.remove(name)
else :
s.add(name)
print s
2018-11-20
举报