0

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}

Pahan
  • 68
  • 1
  • 13

1 Answers1

1

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})
Kevin Choi
  • 747
  • 1
  • 5
  • 17