求大神告知为啥将x = x + 1换个位置就会出错?
s = set(['Adam', 'Lisa', 'Paul'])
L = ['Adam', 'Lisa', 'Bart', 'Paul']
x = 0
while x < 4:
x = x + 1
b = L[x]
if b not in s:
s.add(b)
else:
s.remove(b)
print s
s = set(['Adam', 'Lisa', 'Paul'])
L = ['Adam', 'Lisa', 'Bart', 'Paul']
x = 0
while x < 4:
x = x + 1
b = L[x]
if b not in s:
s.add(b)
else:
s.remove(b)
print s
2018-12-26
举报