Write a program to print words frequncy in a given string


Topic: Write a program to print words frequncy in a given string

Solution

test_str = "It is a great meal at a great restaurant on a great day"
print("Original String: " + str(test_str))
res = {key: test_str.count(key) for key in test_str.split()} 
print("The words frequency: " + str(res))



List all Python Programs