Python Programming - Console Input/Output - Discussion

Discussion Forum : Console Input/Output - General Questions (Q.No. 45)
45.
How can you read a line of text from the console and count the occurrences of each word?
word_count(input())
count_words(input())
word_occurrences = Counter(input().split())
input().count_words()
Answer: Option
Explanation:
To read a line of text from the console and count the occurrences of each word, use Counter(input().split()) from the collections module.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.