python check if string contains substring

>>> str = "Messi is the best soccer player"
>>> "soccer" in str
True
>>> "football" in str
False

Here is what the above code is Doing:
1. We created a string variable called str.
2. We used the in keyword to check if the word “soccer” is in the string str.
3. Since “soccer” is in str, the expression “soccer” in str returns True.
4. We used the in keyword to check if the word “football” is in the string str.
5. Since “football” is not in str, the expression “football” in str returns False.

You can also use the in keyword to check if a character is in a string.

>>> str = “Messi is the best soccer player”
>>> “M” in str
True
>>> “m” in str
False