When I try CheckIO(http://www.checkio.org/), I couldn’t find a good way to count duplicate elements of a list.
lst = [1, 3, 3, 4, 4, 5] lst.count(3) >>2 print [x for x in lst if lst.count(x) > 1] >>[3, 3, 4, 4]
It’s simple…
When I try CheckIO(http://www.checkio.org/), I couldn’t find a good way to count duplicate elements of a list.
lst = [1, 3, 3, 4, 4, 5] lst.count(3) >>2 print [x for x in lst if lst.count(x) > 1] >>[3, 3, 4, 4]
It’s simple…