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

Why is the efficiency of a machine always less than 100 percent?
4. 15 ÷ 6 2⁄3 = A. 100 B. 100 1⁄4 C. 2 3⁄4 D. 2 1⁄4
What is the difference between consequences and implications?
What is the scientific notation of 673.5
The products available for purchase are the demand equilibrium point equilibrium price supply
1. Kennedy’s military policies encouraged more funding for (1 point) nuclear weapons. the Special Forces. diplomatic solutions. the Secret Service. 2. What
The producers at the beginning of Earth's food chain are _____.
an adult mosquitoes lifespan is about 16 days how many minutes is that
What is the correct way of asking someone how well they did in their exams? -How did your exams go?. -How do your exams went?. -How did your exams went?. Ple
Why is CN considered a weak base if its the conjugate base of a weak acid?