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

The measure of angle S is ___ degrees. Round the number to the nearest degree.
Which convention of American government reflects the principle of popular sovereignty?
How do you do distributive property
The function y=−16x2+v0x models Lindy's height in feet above a trampoline x seconds after she jumps straight up. In the equation of the function, v0 is her init
Who is most likely to benefit from use of lithium?
PLZ Answer these questions/Help
a wire is bent to form 4 semicircles. how long is the wire. with diameter of 35 cm
what do you guys think it is??? its psychology
I need help with a faceing math worksheet
What did Russia do in 17-18th cen?