Created
December 30, 2017 12:37
-
-
Save morisasy/4cf5d4861091fb8e738df155064cb5e5 to your computer and use it in GitHub Desktop.
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 word_count(document, search_term): | |
""" Count how many times search_term appears in document. """ | |
words = document.split() | |
answer = 0 | |
for word in words: | |
if word == search_term: | |
answer += 1 | |
return answer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment