如果换一种怎么不能实现
s = set(['Adam', 'Lisa', 'Paul'])
L = ['Adam', 'Lisa', 'Bart', 'Paul']
for name2 in L:
names = name2
for name1 in s:
if name1 == names:
s.remove(name1)
else:
s.add(name1)
print s
s = set(['Adam', 'Lisa', 'Paul'])
L = ['Adam', 'Lisa', 'Bart', 'Paul']
for name2 in L:
names = name2
for name1 in s:
if name1 == names:
s.remove(name1)
else:
s.add(name1)
print s
2020-02-16
举报