How to Check If a Specified Item Exist in a Tuple in Python


In this example we will show how to determine if a specified item is present in a tuple in Python.

Source Code

my_tuple = ('a', 'b', 'c', 'd')

if 'c' in my_tuple:
    print("'c' is in the tuple.")

Output:

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