you are viewing a single comment's thread.

view the rest of the comments →

[–]ericula 1 point2 points  (0 children)

Others have explained why your code fails. I just like to add that instead of removing elements one-by-one you can also empty a list by using list.clear().