Concatenation of Tuples

Concatenation of tuple is the process of joining two or more Tuples. Concatenation is done by the use of ‘+’ operator. Concatenation of tuples is done always from the end of the original tuple. Other arithmetic operations do not apply on Tuples. 

Note- Only the same datatypes can be combined with concatenation, an error arises if a list and a tuple are combined. 

Python3
# Concatenation of tuples
Tuple1 = (0, 1, 2, 3)
Tuple2 = ('Geeks', 'For', 'Geeks')

Tuple3 = Tuple1 + Tuple2

# Printing first Tuple
print("Tuple 1: ")
print(Tuple1)

# Printing Second Tuple
print("\nTuple2: ")
print(Tuple2)

# Printing Final Tuple
print("\nTuples after Concatenation: ")
print(Tuple3)

Output: 

Tuple 1: 
(0, 1, 2, 3)

Tuple2:
('Geeks', 'For', 'Geeks')

Tuples after Concatenation:
(0, 1, 2, 3, 'Geeks', 'For', 'Geeks')

Time Complexity: O(1)
Auxiliary Space: O(1)

Python Tuples

Python Tuple is a collection of Python Programming objects much like a list. The sequence of values stored in a tuple can be of any type, and they are indexed by integers.  Values of a tuple are syntactically separated by ‘commas‘. Although it is not necessary, it is more common to define a tuple by closing the sequence of values in parentheses. This helps in understanding the Python tuples more easily.

Similar Reads

Creating a Tuple

In Python Programming, tuples are created by placing a sequence of values separated by ‘comma’ with or without the use of parentheses for grouping the data sequence....

Python Tuple Operations

Here, below are the Python tuple operations....

Accessing of Tuples

In Python Programming, Tuples are immutable, and usually, they contain a sequence of heterogeneous elements that are accessed via unpacking or indexing (or even by attribute in the case of named tuples). Lists are mutable, and their elements are usually homogeneous and are accessed by iterating over the list....

Concatenation of Tuples

Concatenation of tuple is the process of joining two or more Tuples. Concatenation is done by the use of ‘+’ operator. Concatenation of tuples is done always from the end of the original tuple. Other arithmetic operations do not apply on Tuples....

Slicing of Tuple

Slicing of a Tuple is done to fetch a specific range or slice of sub-elements from a Tuple. Slicing can also be done to lists and arrays. Indexing in a list results to fetching a single element whereas Slicing allows to fetch a set of elements....

Deleting a Tuple

Tuples are immutable and hence they do not allow deletion of a part of it. The entire tuple gets deleted by the use of del() method....

Tuples VS Lists:

SimilaritiesDifferencesFunctions that can be used for both lists and tuples: len(), max(), min(), sum(), any(), all(), sorted() Methods that cannot be used for tuples: append(), insert(), remove(), pop(), clear(), sort(), reverse() Methods that can be used for both lists and tuples: count(), Index() we generally use ‘tuples’ for heterogeneous (different) data types and ‘lists’ for homogeneous (similar) data types.Tuples can be stored in lists.Iterating through a ‘tuple’ is faster than in a ‘list’.Lists can be stored in tuples.‘Lists’ are mutable whereas ‘tuples’ are immutable.Both ‘tuples’ and ‘lists’ can be nested.Tuples that contain immutable elements can be used as a key for a dictionary....