Last active
November 6, 2016 19:13
-
-
Save benrules2/8a0cbd83630502dd5fa8ec45cdd3823e to your computer and use it in GitHub Desktop.
Reddit Sorry Counter
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
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