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

How to record cash sales immediately deposited at bank ​
What is the missing term?​
Find the graph of the inequality y+2>-3(x+1)
7 x [(26 - 5) - (5 + 6)]
Talia was born in 2003. What would be her predicted life expectancy? Show how you found this answer. Is your answer interpolation or extrapolation of the data?
4. Explain what an imaginary number is and its relationship to complex numbers. Then give an example of where complex numbers occur naturally in mathematics.
The economy is in recession. Prices are high and increasing, as are unemployment rates. The Fed has already cut interest rates, but it isn’t working.Congress ha
What is the image point of (2,7) after a translation left 4 units and up 2 units? Please hurry ASAP no links
2/3+1/4= Pls help meeeeeeee
Lord of the Flies Chapter 10-11 Test questions 1-20