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

If your goal is to find a mentor who can help encourage you, which category would it fall into?
What is the table for y=8x+12
Which of the following would a biography not contain? facts and dates story elements imaginative details a theme
Triangle DEF is similar to triangle FGH. Both are right triangles. Which statements about the two triangles must be true? Choose all answers that are correct.
Round the number to the thousandths place. 64,672.318498 a. 64,672.318 b. 65,000 c. 64,672.32 d. 64,672.319
What is 32.60 rounded to the nearest tenth
Which one of the following mathematical statements is true? A. 0 ÷ 28 = 0 B. 28 – 0 = 0 C. 28 ÷ 0 = 0 D. 28 0 = 0
how do you put 0.375,0.300,and 0.387 in order from least to greatest
Simplify the expression. 5 ^ 0 A. 0 b. 0.5 c. 1 d. 50
It is recommended that an adult drink 64 fluid ounces of water every day. Josey has already consumed 700 milliliters of water.How many more liters should he dri