G
Gordon Williams
An easy question....
Why do I get the x printed twice in the sample below? It is like print x is
being executed twice in each loop.
.... l.pop(l.index(x))
.... print l
....
1
1
[2, 3, 4]
2
2
[3, 4]
3
3
[4]
4
4
[]
Regards,
Gordon Williams
Why do I get the x printed twice in the sample below? It is like print x is
being executed twice in each loop.
.... print xl = [1,2,3,4]
for x in l[:]:
.... l.pop(l.index(x))
.... print l
....
1
1
[2, 3, 4]
2
2
[3, 4]
3
3
[4]
4
4
[]
Regards,
Gordon Williams