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 बनाता है।
t1 = ("Abhishek", "Jayati")
t2 = ("Naincy", "Aryan")
joined = t1 + t2
print(joined)
Output:
('Abhishek', 'Jayati', 'Naincy', 'Aryan')
a = ("A",)
b = ("B",)
c = ("C",)
result = a + b + c
print(result)
Output:
('A', 'B', 'C')
students = ("Aryan", "Shrutika")
repeated = students * 2
print(repeated)
Output:
('Aryan', 'Shrutika', 'Aryan', 'Shrutika')