Programming with Python

  1. Home
  2. Docs
  3. Programming with Python
  4. Tuples in python
  5. Operations on Tuples in python

Operations on Tuples in python

The most common operations that we perform with tuple include joining tuples and slicing tuples.

Joining tuples:-

The + operator, the concatenation operator, when used with two tuples, join two tuples.


t1=(1, 2, 3, 4, 5)
t2=(6, 7, 8, 9)
Output- (1,2,3,4,5,6,7,8,9)

Slicing the tuples:-

Tuple slices, like list-slices are the sub parts of the tuple extracted out. We can use indexes of tuple elements to create tuple slices.


Output- (3,4,5)

This is all about operation on tuples in python.

Was this article helpful to you? Yes No

How can we help?