2 Réponses
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.
8th May 2020, 11:31 PM
rodwynnejones
rodwynnejones - avatar