I faced some problem with solving the next problem:
We have a list of elements (integers), and we should return a list consisting of only the non-unique elements in
Try this:
>>> a=[1,2,3,3,4,5,6,6,7,8,9,2,0,0] >>> a=[i for i in a if a.count(i)>1] >>> a [2, 3, 3, 6, 6, 2, 0, 0] >>> a=[1, 2, 3, 1, 3] >>> a=[i for i in a if a.count(i)>1] >>> a [1, 3, 1, 3] >>> a=[1, 2, 3, 4, 5] >>> a=[i for i in a if a.count(i)>1] a []