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

A smoothly operating engine depends on A. equal compression between cylinders. B. cylinder compression levels above 100 PSI and within 70 PSI of each
compare and contrast a quincha home and a Tambo home. write your answer in English.
What is the normal balance for the allowance for doubtful accounts (debit or credit), and why?
which best describes evolutionary theory
what characteristic of the early United States reflected enlightenment ideals?
need help with this math ​
Choose the best translation for the following sentence. Will you help me tomorrow? A. ¿Me ayudaría mañana? B. ¿Me ayudaba mañana? C. ¿Me ayudarás mañana
Find the sum of the finite geometric sequence
i got the lead role in the musical, I'm so excited!
How were the battle of the Alamo and the battle of San Jancinto similar and how were they different?​