Jun-14-2019, 08:41 PM
Printing is 'cheapest' debugging tool. If one adds two print statements everything is quite self-explanatory:
>>> numbers = [3, 3, 20, 6, 10, 6, 5, 5, 7, 10, 7, 19, 19, 20] >>> for x in numbers: ... print(f'x is {x}') ... if numbers.count(x) > 1: ... numbers.remove(x) ... print(numbers) ... x is 3 # first element in numbers [3, 20, 6, 10, 6, 5, 5, 7, 10, 7, 19, 19, 20] x is 20 # second element in numbers [3, 6, 10, 6, 5, 5, 7, 10, 7, 19, 19, 20] x is 10 # third element in numbers [3, 6, 6, 5, 5, 7, 10, 7, 19, 19, 20] x is 5 # fourth element in numbers [3, 6, 6, 5, 7, 10, 7, 19, 19, 20] x is 7 # fifth element in numbers [3, 6, 6, 5, 10, 7, 19, 19, 20] x is 7 # sixth element in numbers x is 19 # seventh element in numbers [3, 6, 6, 5, 10, 7, 19, 20] x is 20 # eight and last element in numbers
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.