Frequency of words counting
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
data = input().split()
for word in data:
count = 0
for item in data:
if word == item:
count += 1
print(word, count)
Hope this is helpful. Write back to me in case you need help with your python task. I generally reply back within 24 hours. You can connect with me on Whatsapp also: +918602715108
Comments
Post a Comment