| Total Complexity | 2 |
| Total Lines | 16 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 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 |