Skip to content

Instantly share code, notes, and snippets.

@benrules2
Last active November 6, 2016 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benrules2/8a0cbd83630502dd5fa8ec45cdd3823e to your computer and use it in GitHub Desktop.
Save benrules2/8a0cbd83630502dd5fa8ec45cdd3823e to your computer and use it in GitHub Desktop.
Reddit Sorry Counter
def get_sorry_and_word_count(comment_list, apologies = ['sorry', 'apologies']):
sorry_count = 0
word_count = 0
for comment in comment_list:
words = comment.split(' ')
word_count += int(len(words))
for word in words:
for apology in apologies:
sorry_count += word.lower().count(apology)
return sorry_count, word_count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment