python count the frequency of words in a list

Do you want to know the details regarding “python count the frequency of words in a list”. If yes, you’re in the correct tutorial.

python count the frequency of words in a list

from collections import Counter
list1=['apple','egg','apple','banana','egg','apple']
counts = Counter(list1)

print(counts)
# Counter('apple': 3, 'egg': 2, 'banana': 1)

Final Thoughts

I hope this post helps you to know about “python count the frequency of words in a list”. If you have any doubts regarding this post please let us know via the comment section. Share this tutorial with your friends & family via social networks.

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coder Diksha. Here, I post about programming to help developers.

Share on:

Leave a Comment