Question

How to find the first and last elements of a tuple in python?

Updated on June 2, 2025 | By Learnzy Admin | πŸ‘οΈ Views: 197 students

Solution
βœ” Verified

Since tuples are ordered collections, you can access elements by their index. The first element is at index 0. And the last element is at index -1.

Example:--

my_tuple = (10, 20, 30, 40, 50)

first_element = my_tuple[0]
last_element = my_tuple[-1]

print("First element:", first_element)
print("Last element:", last_element)
Was this solution helpful? 32
Click here to download practice questions on Python Tuple

More Questions on Python Tuple

Question 1

How to check if a tuple is a subset of another tuple in python ?


View solution
Question 2

How to Merge two tuples and remove duplicates in python.


View solution