Delete unique elements from a list

前端 未结 9 1226
[愿得一人]
[愿得一人] 2020-12-10 09:20

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

9条回答
  •  無奈伤痛
    2020-12-10 10:17

    Just I used list Comprehensions.

    def checkio(data):
        a=[i for i in data if data.count(i)>1]
        return a
    print checkio([1,1,2,2,1,1,1,3,4,5,6,7,8]) 
    

提交回复
热议问题