Question

How to check if a tuple is a subset of another tuple in python ?

Updated on June 2, 2025 | By Learnzy Admin | 👁️ Views: 204 students

Solution
✔ Verified

Use Python’s all() function to test if every element of the first tuple exists in the second tuple.

Example:-

tuple1 = (1, 2, 3)
tuple2 = (5, 3, 2, 1, 4)

is_subset = all(item in tuple2 for item in tuple1)

print(is_subset)  # True
Was this solution helpful? 38
Click here to download practice questions on Python Tuple

More Questions on Python Tuple

Question 1

How to Merge two tuples and remove duplicates in python.


View solution
Question 2

How to find the first and last elements of a tuple in python?


View solution