I need to remove all unique objects in the given lists.
My code passes 1,3,4 checks but doesn't pass 2nd one, it returns [2,4], why not []?
def checkio(data):
for i in data:
if data.count(i) == 1 :
data.remove(i)
return data
if __name__ == "__main__":
assert isinstance(checkio([1]), list), "The result must be a list"
assert checkio([1, 2, 3, 1, 3]) == [1, 3, 1, 3], "1st example"
assert checkio([1, 2, 3, 4, 5]) == [], "2nd example"
assert checkio([5, 5, 5, 5, 5]) == [5, 5, 5, 5, 5], "3rd example"
assert checkio([10, 9, 10, 10, 9, 8]) == [10, 9, 10, 10, 9], "4th example"