1>>> your_list = ['one', 'two', 'one']
2>>> len(your_list) != len(set(your_list))
3True
1def checkDuplicate(user):
2 if len(set(user)) < len(user):
3 return True
4 return False
1def Find_Repeated(x):
2 x2=sorted(x)
3 List_Of_Repeated=[]
4 for i in x2:
5 if x2.count(i)>1:
6 List_Of_Repeated.append([i,x2.count(i)])
7 for c in range(x2.count(i)):
8 for j in x2:
9 if i==j and x2.count(i)>1:
10 x2.remove(i)
11 List_Of_Repeated.sort()
12 return List_Of_Repeated
13
14List=[1,2,3,4,4,4,5,5,5,5,5,1,1,2,2,3,7,8,6]
15
16# Repeated numbers: [1,2,3,4,5]
17
18# Simple print output:
19
20print(Find_Repeated(List),"\n")
21
22# For a neat output:
23
24print("[ Value , Times Repeated ] \n")
25print("For example: [2,4] The value 2 was repeated 4 times. \n")
26for i in Find_Repeated(List):
27 print(i)
28