I want to iterate over a list of words and use a dictionary to keep track of the frequency(count) of each word? Using something like this below :
{'Number': Frequency, '2':2, '3':2}
I want to iterate over a list of words and use a dictionary to keep track of the frequency(count) of each word? Using something like this below :
{'Number': Frequency, '2':2, '3':2}
Please use Counter
= ]
from collections import Counter
some_list = [2,3,4,5,6,6,6,2]
count_dict = Counter(some_list)
print(count_dict)
Counter({2: 2, 3: 1, 4: 1, 5: 1, 6: 3})