Category: Python

Removing list elements in a loop

Have you tried this? Removing elements from a list, one each time, in a loop: >>> ll=[‘1’, ‘2’, ‘3’, ‘4’, ‘1’, ‘2’, ‘3’, ‘4’] >>> for l in ll: … ll.remove(l) … print ll … [‘2’, ‘3’, ‘4’, ‘1’, ‘2’, ‘3’, ‘4’] [‘2’, ‘4’, ‘1’, ‘2’, ‘3’, ‘4’] [‘2’, ‘4’, ‘2’, ‘3’, ‘4’] [‘2’, ‘4’,…

Read the full article

www.000webhost.com