Created
April 15, 2021 19:17
-
-
Save mesiriak/230b7c55f57da202b43007dfc7874a8f to your computer and use it in GitHub Desktop.
Codewars. Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import collections | |
import re | |
def top_3_words(text): | |
c = collections.Counter(re.findall(r"[a-z']*[a-z]+[a-z']*", text.lower())) | |
return [i[0] for i in c.most_common(3)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment