I am trying to remove non repeating characters from a list in python. e.g list = [1,1,2,3,3,3,5,6] should return [1,1,3,3]. My initial attempt was:
def tester(data):
    for x in data:
        if data.count(x) == 1:
            data.remove(x)
    return data
This will work for some inputs, but for [1,2,3,4,5], for example, it returns [2,4]. Could someone please explain why this occurs?
 
     
     
     
     
     
     
    