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 I NEED HELP !!! Define each event in 14 words or less. The definition will be, What the event was and what it led too Sorry the list is long but I need h
3x + 4 = 5x - 2 pleaseeee quick
If Wavelength is 363X10^-9m Find the frequency
Which change to one of the kits would make it useful for modeling proteins? A. Set 1, add a box for phosphorous (P) atoms. B. Set 2, add a box for sulfur (S)
what challenges did Mughal face in their attempts to unify and solidify control over india
need help with 19 and 20 ASAP please
which sentence is an example of how a scientist might use a model?
Determine whether the given ratios are equal or not: 3:2 and 48:32
Decide whether each statement is an example of direct characterization, an example of indirect characterization, or not characterization at all. Toby’s next mov
PLEASE help if you can do both or just one I really need help