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

Which of the following had the least to do with creating the adverse reaction to the stamp act in 1765? A) Offenders would be tried by British vice-admiralty co
This food web represents a community in a rain forest.
It takes you 53 minutes to bike 15 miles. At that same rate, about how long does it take you to bike 100 miles?
Please help me with this question
due to the reduced circulation to the limbs, people with diabetes are at an increased risk of tissue death, which can result in
explain how the layers of the earth are connected and affected by eachother?
Complete the code to generate a pseudo-random integer between 1 and 44, including the possibility of both 1 and 44. >>> import secrets >>> sec
what do you think Hamlet is saying about what it means to be human?
What do bono mean when he tells rose “I’ll keep you straight you get off the track she’ll straighten you “up mean l
Really please help me out instead of getting the points