0
To find the duplicates
def dup (l): s=[] for i in l: if (l.count (i)>1): s.append (i) print (s) x=[1,2,2,3,4,5,5,6] dup (x) OUTPUT: [2,5]
1 Answer
def dup (l): s=[] for i in l: if (l.count (i)>1): s.append (i) print (s) x=[1,2,2,3,4,5,5,6] dup (x) OUTPUT: [2,5]