Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Monkey Typing by mdroz
def count_words(text, words):
i=0
for w in words:
if(str.find(text.lower(),w)!=-1):
i+=1
return i
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"
Oct. 23, 2017