Home ยป Concatenating two Tuples in python

Concatenating two Tuples in python

We can add two tuples using the + operator.

The resultant tuple will have items from both the tuples.

Example

tuple1 = (1, 2, 3, 4, 5, 6)
tuple2 = (3, 4, 5, 6, 7, 8)

# concatenate tuples using the + operator
tuple3 = tuple1 + tuple2
print(tuple3)

When you run this you will see something like this

>>> %Run concatenatetuple.py
(1, 2, 3, 4, 5, 6, 3, 4, 5, 6, 7, 8)

You may also like

Leave a Comment

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More