Contact: aviboots(AT)netvision.net.il
41,636 questions
54,299 answers
573 users
import collections lst = [1, 1, 2, 3, 4, 4, 4, 5, 6, 6, 7, 7, 7, 7] count_elements = {i:lst.count(i) for i in lst} for key, value in count_elements.items(): print(key, " : ", value) ''' run: 1 : 2 2 : 1 3 : 1 4 : 3 5 : 1 6 : 2 7 : 4 '''