Question

How to Merge two tuples and remove duplicates in python.

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

Solution
✔ Verified

Steps:--

  • Tuples themselves don’t support removing duplicates directly because they are immutable.
  • So, first concatenate the tuples.
  • Convert the concatenated tuple into a set to remove duplicates (sets store unique items).
  • Convert back to a tuple if you want the result as a tuple.
tuple1 = (1, 2, 3, 4)
tuple2 = (3, 4, 5, 6)

# Merge tuples
merged = tuple1 + tuple2

# Remove duplicates by converting to set, then back to tuple
result = tuple(set(merged))

print(result)
Was this solution helpful? 40
Click here to download practice questions on Python Tuple

More Questions on Python Tuple

Question 1

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


View solution
Question 2

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


View solution