I would like to give some feedback about ...
From: http://www.checkio.org/mission/monkey-typing/solve/
This is my code:
def count_words(text, words):
count = 0
for word in words:
if word in text:
count = count + 1
print(count)
return count
if __name__ == '__main__':
#These "asserts" using only for self-checking and not necessary for auto-testing
assert count_words("How aresjfhdskfhskd you?", {"How", "are", "you", "hello"}) == 3, "Example"
assert count_words("Bananas, give me bananas!!!", {"banana", "bananas"}) == 2, "BANANAS!"
assert count_words("Lorem ipsum dolor sit amet, consectetuer adipiscing elit.",
{"sum", "hamlet", "infinity", "anything"}) == 1, "Weird text"
I keep getting this message:
Your result: 2
Right result: 3
Fail: count_words('How aresjfhdskfhskd you?', {'you', 'how', 'hello', 'are'})
Created at: 2015/10/06 17:51; Updated at: 2015/10/06 19:34