Solution 1

``````def all_in_string(a_string, s1, s2, s3):
total = 0
if s1 in a_string:
total += 1

if s2 in a_string:
total += 1

if s3 in a_string:
total += 1

``````

# All in String

The function `all_in_string` receives a phrase and 3 words, and it should count how many of those words appear in the original phrase at least once.

Example, given the sentence from our previous assignment:

Courage is not the absence of fear, but rather the judgement that something else is more important than fear
(Ambrose Redmoon)

How many of the following words you see included in that sentence: `fear`, `judgement`, `Python`? The answer is `2`, because only `fear` and `judgement` are part of the original sentence.

Examples of `all_in_string`:

``````phrase = "Python is good. Python is Wise. I like Python"

all_in_string(phrase, 'Python', 'good', 'Ruby')  # 2
all_in_string(phrase, 'Python', 'Javascript', 'Ruby')  # 1
all_in_string(phrase, 'Python', 'Wise', 'good')  # 3
all_in_string(phrase, 'Ruby', 'Javascript', 'Perl')  # 0
``````

Hint: The `in` operator might be handy.

### Test Cases

test two in string -

``````def test_two_in_string():
assert all_in_string('abcd', 'a', 'b', 'X') == 2
assert all_in_string('abcd', 'a', 'X', 'b') == 2
assert all_in_string('abcd', 'X', 'a', 'b') == 2
``````

test repeated words -

``````def test_repeated_words():
a_string = "Python is good. Python is Wise. I like Python"
assert all_in_string(a_string, 'Python', 'good', 'Ruby') == 2
``````

test only one in string -

``````def test_only_one_in_string():
assert all_in_string('abcd', 'a', 'X', 'Y') == 1
assert all_in_string('abcd', 'X', 'a', 'Y') == 1
assert all_in_string('abcd', 'Y', 'X', 'a') == 1
``````

test three in string -

``````def test_three_in_string():
assert all_in_string('abcd', 'a', 'b', 'c') == 3
``````
def all_in_string(a_string, s1, s2, s3): pass