How to Determine If a Specified Item Exists in a List in Python


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.
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments