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 the MAD of the data set? {5, 12, 1, 6, 11} Enter your answer in the box
Please help me with this.
How would a sudden decrease in the rabbit population on an island affect another species there? * A. The population of eagles would probably increase. B. The po
What’s 3.192 rounded to the nearest hundredth ?
Which of the following is a “guns or butter” decision? A country must decide whether to use its steel to build new fighter jets or new sports cars. A man must d
How has terrorism become a part of modern global conflicts?
One important way in which banks make economic growth possible is by
Find the quotient of 569.7 divided by 10 to the 3 power
"if the ph of a solution is _____ the solution is basic. a. 2b. 5c. 7d. 10"
I WILL MARK BRAINLIEST!!!!!! What is the distance between A and B? Round your answer to the nearest hundredth. A. 9.58 B. 10.63 C. 11.56 D. 12.29