B.Tech Students: Apply for Live Programming Internship C, C++, Java, Python ,Web page Designing, PHP Join Tuples in Python with Examples | LiveCodeProgramming

Joining Tuples in Python

In Python, you can join two or more tuples using the + operator. Tuples are immutable, so this operation returns a new tuple.

Python में + ऑपरेटर का उपयोग करके दो या अधिक tuples को जोड़ा जा सकता है। Tuple immutable होता है, इसलिए यह नया tuple बनाता है।

1. Join Two Tuples
t1 = ("Abhishek", "Jayati")
t2 = ("Naincy", "Aryan")
joined = t1 + t2
print(joined)
Output:
('Abhishek', 'Jayati', 'Naincy', 'Aryan')
2. Join Multiple Tuples
a = ("A",)
b = ("B",)
c = ("C",)
result = a + b + c
print(result)
Output:
('A', 'B', 'C')
3. Repeat Tuple
students = ("Aryan", "Shrutika")
repeated = students * 2
print(repeated)
Output:
('Aryan', 'Shrutika', 'Aryan', 'Shrutika')