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 type of materials would scientists date with the carbon-14 method?
Triangle FGH is similar to triangle A B C
Joyce paid $94.50 for an item at the store that was 55 percent off the original price. What was the original price?
Can someone plzzz tell me if #14. b. is right plzz
samuel has a hamster cage that is a rectangular prism. it is 20 inches long, 12 inches deep, and 10 inches tall. what is the volume, in cubic inches, of samuelâ
can you explain me why humans die everyday?
What is the ones digit in the number 3^2082?
Question 1 of 25 In preparing for his group's party, Ozzie cut up 26 strawberries. Then he answered a phone call. After the call, he cut up 18 more strawberries
Write a superlative sentence.​
Change to the passive form 1. Turn these sentences from the active to the passive. Remember to keep the sentence in the same tense as the original. 1.1 Global w