+ 1
Why this list not removing 3 after 2?
1 Respuesta
0
l=[1,2,3,4,5,3,2,1 ]
l.sort()
print(l)
for i in l[:]: # < do this.
print (i)
while i in l:
l.remove(i)
print (l)
When ever you modify the length of an iterable, (in this case..."remove") you should loop over a copy of it.
Although...I'm not sure what your trying to do.