In this example we will show how to check if a certain phrase or character is present in a string in Python.
Source Code
my_str = 'I love Python'
check = 'o' in my_str
print(check)
Output:
True
In this example we will show how to check if a certain phrase or character is present in a string in Python.
my_str = 'I love Python'
check = 'o' in my_str
print(check)
Output:
True
In this example, we will learn how to check if a certain phrase or character is NOT present in a string in Python.
my_str = 'I love Python'
check = 'o' not in my_str
print(check)
Output:
False