How to Check If Specified Item Is Present in Set in Python


In this example we will show how to check if the specified item is present in the set in Python.

Source Code

my_set = {'a', 'b', 1, 2, 'c'}

if 'c' in my_set:
    print("'c' is in the my_set")

Output:

'c' is in the my_set
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments