Westonci.ca is your go-to source for answers, with a community ready to provide accurate and timely information. Explore thousands of questions and answers from a knowledgeable community of experts ready to help you find solutions. Join our Q&A platform to connect with experts dedicated to providing accurate answers to your questions in various fields.

Write a program that reads a list of words. Then, the program outputs those words and their frequencies. Ex: If the input is: hey hi Mark hi mark

Sagot :

Answer:

The program in Python is as follows:

wordInput = input()

myList = wordInput.split(" ")

for i in myList:

   print(i,myList.count(i))

Explanation:

This gets input for the word

wordInput = input()

This splits the word into a list using space as the delimiter

myList = wordInput.split(" ")

This iterates through the list

for i in myList:

Print each word and its count

   print(i,myList.count(i))