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

Cameron's book like shows that he read a total of 4 1/4 hours last month how many minutes is that
For the electric field shown, which of the following statements describes an increase in voltage? A) A negative charge crosses an equipotential line toward the
What made world war 2 a total war
GETS BRAINLIEST AND 11 PTS! Judith is digging for sandstone at a geological site. She has 160 meters of rope and 4 stakes to mark off a rectangular area. Which
PLEASE HELP ME WITH A SIMPLE ENGLISH QUESTION
Which of the following describes a difference between affranchis and French aristocrats in saint Domingue? A. French Aristocrats were influenced by the enlighte
5 plus 5 divided by 2 times 300032 plus 6
2/3 - 4x + 7/2 = -9x + 5/6
Find the area of a parallelogram with a height of 2x - 3 and a base of x + 4.
the best explanation of the importance of the 24 amendment