Answer:
The program in Python is as follows:
mylist = []
nword= "y"
while(nword== "y"):
word = input(": ")
mylist.append(word)
nword = input("New word: y/n: ")
for item in mylist:
freq = mylist.count(item)
print(item, freq)
Step-by-step explanation:
This creates an empty list
mylist = []
This is used to let the user input more word or stop input
nword = "y"
The following iteration lets the program read words from the user
while(nword == "y"):
This gets the user input
word = input(": ")
This appends the inputted word into the list
mylist.append(word)
This prompts if the user wants to input more word or not
nword = input("New word: y/n: ")
This iterates through the list
for item in mylist:
This gets the frequency of each word in the list
freq = mylist.count(item)
This prints the word and the frequency
print(item, freq)