Programming Languages Python Subjective
Sep 30, 2025

Write a Python function to count word frequency in a text.

Detailed Explanation
def word_frequency(text):\n words = text.lower().split()\n freq = {}\n for word in words:\n freq[word] = freq.get(word, 0) + 1\n return freq\n\n# Or using Counter: from collections import Counter; Counter(text.split())
Discussion (0)

No comments yet. Be the first to share your thoughts!

Share Your Thoughts
Feedback