Python | Program to print duplicates from a list of integer

preview_player
Показать описание
# Python program to print
# duplicates from a list
# of integers
def Repeat(x):
_size = len(x)
repeated = []
for i in range(_size):
k = i + 1
for j in range(k, _size):
if x[i] == x[j] and x[i] not in repeated:
return repeated

# Driver Code
list1 = [10, 20, 30, 20, 20, 30, 40,
50, -20, 60, 60, -20, -20]
print (Repeat(list1))

Output
[20, 30, -20, 60]
Рекомендации по теме
welcome to shbcf.ru