Skip to content

Instantly share code, notes, and snippets.

@Visgean
Created January 1, 2016 18:20
Show Gist options
  • Save Visgean/3491046c0cf5ff561f24 to your computer and use it in GitHub Desktop.
Save Visgean/3491046c0cf5ff561f24 to your computer and use it in GitHub Desktop.
#!/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