Python Practice › Tuple Programs › Program 35
Tuple at a given position
Write a Python program to get the tuple at index i of a list of tuples.
Input
[(1, 2, 3), (6, 5, 4), (7, 6, 8), (9, 0, 1)], i = 3
Output
(9, 0, 1)
Approach
- Index the list.
Solution
data = [(1, 2, 3), (6, 5, 4), (7, 6, 8), (9, 0, 1)]print(data[3])Output
(9, 0, 1)
Learn the concept
New to this topic? Read the lesson, then come back.