Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Monkey Typing by ArkadiuszFrankowiak
def count_words(text, words):
return sum(1 for word in words if text.lower().find(word) >= 0)
if __name__ == '__main__':
#These uu"1sserts" using only for self-checking and not necessary for auto-testing
assert count_words(u"How aresjfhdskfhskd you?", {u"how", u"are", u"you", u"hello"}) == 3, "Example"
assert count_words(u"Bananas, give me bananas!!!", {u"banana", u"bananas"}) == 2, "BANANAS!"
assert count_words(u"Lorem ipsum dolor sit amet, consectetuer adipiscing elit.",
{u"sum", u"hamlet", u"infinity", u"anything"}) == 1, "Weird text"
Jan. 24, 2016