non_unique_elements   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 16
rs 10
c 0
b 0
f 0
wmc 2

1 Function

Rating   Name   Duplication   Size   Complexity  
A checkio() 0 4 2
1
from collections import Counter
2
3
4
def checkio(data):
5
    for i in [x for x, y in Counter(data).items() if y == 1]:
6
        data.remove(i)
7
    return data
8
9
10
# for self-testing
11
if __name__ == "__main__":  # pragma: no cover
12
    assert checkio([1, 2, 3, 1, 3]) == [1, 3, 1, 3], "1st example"
13
    assert checkio([1, 2, 3, 4, 5]) == [], "2nd example"
14
    assert checkio([5, 5, 5, 5, 5]) == [5, 5, 5, 5, 5], "3rd example"
15
    assert checkio([10, 9, 10, 10, 9, 8]) == [10, 9, 10, 10, 9], "4th example"
16