6.18 lab: word frequencies 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 the output is: hey 1 hi 2 mark 1 hi 2 mark 1

Respuesta :

A program that reads a list of words. then, the program outputs those words and their frequencies is given below:

The Program

line = input ( )

norm = line . split ( )

low = line . lower ( ) . split ( )

for chr in low :

   freq = low . count ( chr )

   print ( freq )

for x in norm:

   print ( x )

The Output

1

2

2

2

2

hey

Hi

Mark

hi

mark

There are other ways to write a program that does this same function and they are given below:

1. for word, word_lower in zip ( norm, low ):

   print ( word, low. count (word _ lower ) )

2. wordInput = input ( )

myList = wordInput . split ( " ")

for i in myList :

 print ( i , myList . count ( i ) )

Read more about programming here:

https://brainly.com/question/23275071

#SPJ1