Skip to content

Commit

Permalink
word-count: fix lambda usage (see exercism#287)
Browse files Browse the repository at this point in the history
  • Loading branch information
behrtam committed Jan 25, 2016
1 parent 8dc1d9f commit 12b48b1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion word-count/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def decode_if_needed(string):


def word_count(text):
replace_nonalpha = lambda c: c.lower() if c.isalnum() else ' '
def replace_nonalpha(char):
return char.lower() if char.isalnum() else ' '
text = ''.join(replace_nonalpha(c) for c in decode_if_needed(text))
return Counter(text.split())

0 comments on commit 12b48b1

Please sign in to comment.