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

Electronic ledger that tracks mathematical data
If the pressure, volume, and temperature of a gas are known, which can most likely be found by using the ideal gas law
Sequential means “in order”. Please select the best answer from the choices provided T/F
Although the Crusades led to an increase in travel and trade, Western Europe still had little interaction with the new cultures encountered. a. True b. False
how do you graph y=5x+7
The ___________ expressed the darkest and most ominous aspect of the rural counterattack of the early 1900s. A. Red Scare B. Ku Klux Klan C. Prohibition movemen
calculate the velocity of a 1650 kilogram satellite.
True/False – The following sentence is an example of inclusive language. A doctor must have a lot of schooling before he can receive his license. a. True b. Fal
what is the charactics of igneous
The element Ag has how many protons?