Python – Join Tuples

1. What Does β€œJoin Tuples” Mean?

Joining tuples means combining two or more tuples into one tuple.

Tuples are read-only, so we cannot change them.
But we can create a new tuple by joining existing tuples.

2. Join Tuples Using + Operator

The easiest way to join tuples is using +.

Example

tuple1 = (1, 2, 3)
tuple2 = (4, 5, 6)
new_tuple = tuple1 + tuple2
print(new_tuple)

Output:

(1, 2, 3, 4, 5, 6)

πŸ‘‰ A new tuple is created.

3. Join More Than Two Tuples

Example

a = ("red", "blue")
b = ("green",)
c = ("yellow", "black")
colors = a + b + c
print(colors)

4. Join Tuple with One Item (Important)

When joining one item, always use a comma.

Example

fruits = ("apple", "banana")

fruits = fruits + (“orange”,)
print(fruits)

❌ Without comma, Python will give an error.

5. Join Tuples Using Loop (Advanced)

Example

t1 = (10, 20)
t2 = (30, 40)
temp = list(t1)

for item in t2:
temp.append(item)

result = tuple(temp)
print(result)

6. Join Tuples Using * (Repeat Tuple)

You can repeat tuple items using *.

Example

nums = (1, 2)

new_nums = nums * 3
print(new_nums)

Output:

(1, 2, 1, 2, 1, 2)

7. Common Beginner Mistakes

❌ Trying to Use append()

t1.append(4)

❌ Error: tuple has no append.

❌ Forgetting Comma in Single Item

fruits = fruits + ("grape")

βœ” Correct:

fruits = fruits + ("grape",)

8. Simple Practice Examples

Example 1: Join Student Names

group1 = ("Amit", "Ravi")
group2 = ("Sita", "Gita")
students = group1 + group2
print(students)

Example 2: Join Numbers

nums1 = (1, 2)
nums2 = (3, 4)
nums = nums1 + nums2
print(nums)

Example 3: Repeat Tuple

days = ("Mon", "Tue")
print(days * 2)

9. Summary (Join Tuples)

βœ” Tuples cannot be changed
βœ” + joins tuples
βœ” Always use comma for one item
βœ” * repeats tuples
βœ” New tuple is created

πŸ“˜ Perfect for Beginner eBook

This chapter is ideal for:

  • Python beginner books

  • School & college students

  • Self-learners

If you want next, I can write:

  • Tuple Methods

  • Tuple Exercises

  • Sets (easy)

  • Dictionaries (easy)

Just tell me 😊

You may also like...