python_math_stat/practica/stepik/beneficial_features/double.py
2023-10-05 14:42:05 +03:00

24 lines
655 B
Python

# нахождение дубликатов и вывод уникальных элементов
a = input().split()
a2 = []
for item in a:
c = a.count(item)
if c > 1:
a2.append(item)
if c == 1:
None
def del_dubl(a2):
seen = set()
seen_add = seen.add
return [x for x in a2 if not (x in seen or seen_add(x))]
for i in del_dubl(a2):
print(i, end=' ')
# удаление дубликатов и вывод уникальных в виде списка
a = input().split()
def del_dubl(a):
seen = set()
seen_add = seen.add
return [x for x in a if not (x in seen or seen_add(x))]
print (del_dubl(a))