briiiii8719 briiiii8719
  • 03-07-2021
  • Computers and Technology
contestada

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

Respuesta :

MrRoyal
MrRoyal MrRoyal
  • 03-07-2021

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))

Answer Link

Otras preguntas

1. Briefly explain what a resource market is. Then, describe the role that resource markets play in the flow of goods and services in an economy. In forming you
This is a 30-60-90 triangle. a What is the measure of x? Х 43 X= = [ ?
you wrote a poem . (passive voice)​
In a hospital, 1,250 twins occur in one year? How many sets of twins are likely to be born?
akbar embraced all religions and showed respect towards people of other faiths. what values did akbar promote
HELP ASAP PLEASE!!!!!!!​
please help me on the question​
Describe each of the three categories that money is generally placed in. Include an example of each. (4 points) Subject is (Economic)
Which graph can be used to find the solutions to x^2-4x+4=2x+1+x^2
Rewrite the equation in Ax+By=C form. Use integers for A, B, and C. y-4=-5(x-5)