Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Remove unique data solution in Clear category for Non-unique Elements by yuzu_chimp
from collections.abc import Iterable
def checkio(data: list[int]) -> Iterable[int]:
# your code here
unique_list = []
for x in data:
if data.count(x) == 1:
unique_list.append(x)
for x in unique_list:
data.remove(x)
return data
print("Example:")
print(list(checkio([1, 2, 3, 1, 3])))
# These "asserts" are used for self-checking
assert list(checkio([1, 2, 3, 1, 3])) == [1, 3, 1, 3]
assert list(checkio([1, 2, 3, 4, 5])) == []
assert list(checkio([5, 5, 5, 5, 5])) == [5, 5, 5, 5, 5]
assert list(checkio([10, 9, 10, 10, 9, 8])) == [10, 9, 10, 10, 9]
assert list(checkio([2, 2, 3, 2, 2])) == [2, 2, 2, 2]
assert list(checkio([10, 20, 30, 10])) == [10, 10]
assert list(checkio([7])) == []
assert list(checkio([0, 1, 2, 3, 4, 0, 1, 2, 4])) == [0, 1, 2, 4, 0, 1, 2, 4]
assert list(checkio([99, 98, 99])) == [99, 99]
assert list(checkio([0, 0, 0, 1, 1, 100])) == [0, 0, 0, 1, 1]
assert list(checkio([0, 0, 0, -1, -1, 100])) == [0, 0, 0, -1, -1]
print("The mission is done! Click 'Check Solution' to earn rewards!")
June 4, 2023