Tuple Slicing - Python

Last Updated : 16 Jul, 2026

Tuple slicing is used to extract a portion of a tuple by specifying a range of indices. Since tuples are immutable, slicing creates a new tuple without modifying the original tuple.

Python
fruits = ("Apple", "Banana", "Cherry", "Mango", "Orange")
res = fruits[1:4]
print(res)

Output
('Banana', 'Cherry', 'Mango')

Explanation: expression fruits[1:4] extracts the elements from index 1 up to index 4 (excluding 4) and returns a new tuple containing ('Banana', 'Cherry', 'Mango').

Syntax

tuple[start : stop : step]

Parameters:

  • start: index from which slicing begins (inclusive). If omitted, slicing starts from the beginning of the tuple.
  • stop: index at which slicing ends (exclusive). If omitted, slicing continues to the end of the tuple.
  • step: number of positions to move after each element. If omitted, the default value is 1.

Returns: A new tuple containing the elements selected from the specified range.

Examples

Example 1: Here, we extract the top three scores from a tuple containing students' marks.

Python
scores = (98, 95, 92, 89, 85, 80)
res = scores[:3]
print(res)

Output
(98, 95, 92)

Explanation: expression scores[:3] extracts the first three elements of the tuple. This is useful when only the highest-ranking or first few records are required.

Example 2: Here, we use negative indices to extract elements from the end of a tuple.

Python
months = ("Jan", "Feb", "Mar",
          "Apr", "May", "Jun",
          "Jul", "Aug", "Sep",
          "Oct", "Nov", "Dec")

res = months[-3:]
print(res)

Output
('Oct', 'Nov', 'Dec')

Explanation: expression months[-3:] starts from the third-last element and extracts all remaining elements, returning the last three months of the tuple.

Example 3: Here, we use the step value to select every second element from a tuple.

Python
num = (10, 20, 30, 40, 50, 60, 70, 80)
res = num[::2]
print(res)

Output
(10, 30, 50, 70)

Explanation: expression numbers[::2] starts from the beginning of the tuple and selects every second element because the step value is 2.

Example 4: Here, we reverse the order of elements in a tuple using slicing.

Python
days = ("Monday", "Tuesday", "Wednesday", "Thursday", "Friday")
res = days[::-1]
print(res)

Output
('Friday', 'Thursday', 'Wednesday', 'Tuesday', 'Monday')

Explanation: expression days[::-1] uses a step value of -1 to traverse the tuple from the last element to the first, creating a new tuple with the elements in reverse order.

Comment