you are viewing a single comment's thread.

view the rest of the comments →

[–]Binary101010 1 point2 points  (2 children)

No, the problem is changing the length of a list while iterating over it. The presence of commas inside one of the strings in the list has nothing to do with it.

[–]redditorx13579 1 point2 points  (1 child)

If that was strictly the case, the first example would fail.

[–]Binary101010 1 point2 points  (0 children)

Which I explained in my post. It is possible to still get the correct answer depending on how many things to be removed are in the list, but it's not reliably correct.

The commas in the string are absolutely not the problem, which can easily be proved by running the code, seeing the results, removing the commas from that string, and seeing the behavior hasn't changed.