Light Mode
Dark Mode
Can anybody tell me what's wrong with this code?
def checkio(data):
    lst = data
    for i in data:
        if data.count(i) == 1:
            lst.remove(i)
    return lst

L = [2,4]

print checkio(L)

The result is [4]. Can anyone kindly tell me why this happens?

Thanks.

Created: Sept. 16, 2015, 12:14 p.m.
Updated: Sept. 16, 2015, 6:10 p.m.
0
2
User avatar
domonless