In this example we will show how to determine if a specified item exists in a list in Python.
Source Code
my_list = ['a', 'b', 'c', 'd', 'e']
if 'c' in my_list:
print("'c' is in the list.")
Output:
'c' is in the list.
In this example we will show how to determine if a specified item exists in a list in Python.
my_list = ['a', 'b', 'c', 'd', 'e']
if 'c' in my_list:
print("'c' is in the list.")
Output:
'c' is in the list.