Python Practice › Tuple Programs › Program 11

Is an element in a tuple?

EasyTuple Programs · 11 of 70

Write a Python program to check whether an element exists in a tuple.

Advertisement
Input
("p", "y", "t", "h", "o", "n"), check "p" and "z"
Output
True False

Approach

  1. in.

Solution

Python
t = ("p", "y", "t", "h", "o", "n")print("p" in t, "z" in t)
Output
True False
Advertisement

Learn the concept

New to this topic? Read the lesson, then come back.

More tuple programs

← All 70 Tuple Programs