Python Practice › Tuple Programs › Program 11
Is an element in a tuple?
Write a Python program to check whether an element exists in a tuple.
Input
("p", "y", "t", "h", "o", "n"), check "p" and "z"Output
True False
Approach
in.
Solution
t = ("p", "y", "t", "h", "o", "n")print("p" in t, "z" in t)Output
True False
Learn the concept
New to this topic? Read the lesson, then come back.