Created
January 1, 2016 18:20
-
-
Save Visgean/3491046c0cf5ff561f24 to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env python | |
import sys | |
import operator | |
from collections import Counter | |
def highess_likeness(words): | |
letter_count = Counter(''.join(words)) | |
word_score = [ | |
[word, sum([letter_count[l] for l in word])] | |
for word in words | |
] | |
return sorted(word_score, key=operator.itemgetter(1), reverse=True) | |
for word, score in highess_likeness(sys.argv[1:]): | |
print word, score |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment