Hope you all are fine i am trying to Find the word that appears most frequently in that string and the total number of times that word appears in that string i have managed to find the word but having trouble with counting it and returning it
from statistics import mode
test_list ="a cat in a hat and a big black bear on a big black rug"
print("The original list is : " + str(test_list))
temp = [wrd for sub in test_list for wrd in sub.split()]
res = mode(temp)
print("Word with maximum frequency : " + str(res))
SO i want to have output same as this one Expected output
please help me and thanks in advance