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

Please help I’m just tryna graduate!
How many citizens of mexico does it take to equal the ecological footprint of the average citizen of the united states?
How much fabrick would i need to make a curtian that covers 17 in x 29?
explain why mutation and natural selection make developing new flu vaccines every year necessary
How was the James Oglethorpe a progressive leader during the establishment of the georgia colony?
4(2x+7)-3(x-1) binomial in simplest form
What is one value of Korean culture that is revealed in this passage? A) the fun and joy of playing pranks on others B) the importance of manners and cons
A dog growls when a predator gets close. Growling is an example of which animal behavior?
theo made sails for a model boat. he cut along the diagonal of a rectangular piece o cloth to make two sails
In a paragraph, explain how Ortiz Cofer and Levins Morales express cultural identity through poetry. Use specific examples from each poem in your answer.