def purify(lists): for i in lists: if i % 2 == 1: lists.remove(i) return lists a = [1,2,3,4,5,6,7,9,11,13] print purify(a)
it returns [2,4,6,9,13]
i seem to know what the problem is, but I can’t figure out where is wrong.
using “for” method allows you to loop through the whole list.
plz help me!