Skip to content

Commit

Permalink
Merge pull request #29 from bmistree/master
Browse files Browse the repository at this point in the history
Add a single-line code golf example
  • Loading branch information
crista committed May 21, 2016
2 parents aac9f98 + c94acde commit d521abd
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions 06-code-golf/tf-06-bm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print (reduce(lambda string, tup: string + tup[0] + ' - ' + str(tup[1]) + '\n', sorted( filter(lambda tup: tup[0] not in open(__import__('os').path.join(__import__('os').path.dirname(__file__), '..', 'stop_words.txt')).read().lower().split(','), reduce(lambda word_dict, word: word_dict if (word_dict.__setitem__(word, word_dict.get(word, 0) + 1) if True else None) else word_dict, filter(lambda word: len(word) > 1, (''.join(map(lambda letter: ' ' if ord(letter) not in set(range(ord('a'), ord('z') + 1)) else letter, open(__import__('sys').argv[1]).read().lower()))).split()), {}).iteritems()), key=lambda tup: tup[1], reverse=True)[0:25], '')) # hole in one?

0 comments on commit d521abd

Please sign in to comment.