Answers for "how to find repeated words in python"

0

how to find most repeated word in a string in python

from collections import Counter

# Example phrase 
phrase = "John is the son of John second. Second son of John second is William second."
split_phrase = phrase.split()

# create counter object
Counter = Counter(split_phrase)

most_occured_words = Counter.most_common(4)
  
print(most_occured_words)
Posted by: Guest on July-01-2021
0

repetition of word in python

#repeatition of the object n times
n=int(input('enter the number to be repeated='))
print('hello '*n)

#output:
enter the number to be repeated=
hello .. .....
Posted by: Guest on November-28-2021

Code answers related to "how to find repeated words in python"

Python Answers by Framework

Browse Popular Code Answers by Language