+ 1

How to count number of duplicate values in list ?

Python

20th Apr 2020, 3:31 PM
anand Pandit
anand Pandit - avatar
2 Respuestas
+ 5
len(list(filter(lambda x: l. count(x) >2,l))) if l is your list
20th Apr 2020, 3:36 PM
Oma Falk
Oma Falk - avatar
+ 3
lst = [1,0,0,1,1,2,0,2,4,1,4,5] d = dict.fromkeys(lst, 0) for k in lst: d[k] += 1 print(*d.items()) >>> (1, 4) (0, 3) (2, 2) (4, 2) (5, 1)
20th Apr 2020, 3:57 PM
Vitaly Sokol
Vitaly Sokol - avatar