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

what is pi's full number at 100th diget
PLS HELP 20 POINTS Simplify a √250 show you explanation
find the value of x , please
solve the following system of equations x+8y=21 -x-11y=-27
10 m-1n-5 , for m = 10 and n= -2
Which of the following is an example of conduction? OPTIONS Touching a stove and burning your hand An old-fashioned radiator Heat from a fire Batteries
A camera on a tripod shows the ground floor of a skyscraper and then moves upward to show its entire length. what camera movement was used?
Molality is a way to express the concentration of a solution that represents the number of moles of solute per kilogram of solvent. How does molality of a sucro
A square tablecloth covers 6 square feet. What is the approximate length of one side of the tablecloth?
Which of the following medical terms does NOT refer to an anatomical plane? Transverse Horizontal Sagittal Supine Coronal