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

Change the expression into a fraction: (3x/2y+3) + (x^2+3x/4xy−3−2y+6x)
Use the formula to find the length of the radius if the area is 25 square centimeters.Round your final answer to the nearest tenth of a centimeter. [tex]\sqrt{\
Which ecosystems do NOT have symbiotic relationships? A. deserts B. All ecosystems contain symbiotic relationships. C tropical rainforests
Write the difference as a mixed number? 2/6/8 - 1/5/8 ?
Bonjour, je m’appelle Sylvie, j’habite à Deauville en Normandie.  Aujourd’hui nous allons en voyage. D’abord, nous allons au café Place Morny pour manger un san
Who is the captain of England in 1966
The sine ratio of an angle is the opposite side over the adjacent side.alwaysneversometimes
2a - 3 = -5 in algebra tiles
How do you divide 3 1/4 and 3?
Los Alamos National Labs (LANL) produces radioactive products to be used in all of the following area, except which? a medicine b. homeland security C agricult