generated from github/haikus-for-codespaces
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2_5_11.py
36 lines (33 loc) · 1.04 KB
/
2_5_11.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
'''
Напишите программу, которая принимает на вход список чисел в одной строке и выводит на экран в одну строку значения, которые встречаются в нём более одного раза.
Для решения задачи может пригодиться метод sort списка.
Выводимые числа не должны повторяться, порядок их вывода может быть произвольным.
Sample Input 1:
4 8 0 3 4 2 0 3
Sample Output 1:
0 3 4
Sample Input 2:
10
Sample Output 2:
Sample Input 3:
1 1 2 2 3 3
Sample Output 3:
1 2 3
Sample Input 4:
1 1 1 1 1 2 2 2
Sample Output 4:
1 2
'''
numbers = [int(i) for i in input().split()]
list = []
for number in numbers:
ind = numbers.index(number)
ind_2 = int(ind) + 1
for j in numbers[ind_2:]:
if number == j:
list.append(number)
list_new = []
for i in list:
if i not in list_new:
list_new.append(i)
print(*list_new)