Accessing the first element and the last element of the tuple requires index operator([]). You can find the first element and last element of tuple using Python. Get your single element of tuple with the methods given here.

In addition to this, you can also get elements from first to the last of given tuple using Python. You may also like to read how to create tuple variable using Python

Get the First Element Of Tuple Using Python

If you want to get the first element of the tuple, you have to use the index operator([]). You have to pass zero(0) as the argument of the index operator.

The first element starts with the zero(0) index and places inside the tuple in Python. See the example below and use it to get the first element from the tuple.



The above example gives the first element as the single element in the output. The tuple contains 4 elements and prints “Bihar” which is the first element. The output prints elements without the parenthesis or round brackets.

Find Last Element Of Tuple Using Python

If you want to find the last item from the tuple, you have to pass -1 as an argument of an index operator. It finds the last element from the tuple and print in the output. Check and use the below-given example to your last item from the tuple.



The above example contains the last element which is 13. There are four elements in the tuple of the above example. The output gives a single item which the last item of tuple using Python.

Access First to the Last Elements of Tuple in Python

In addition to the above all methods, there is another simple method to get all elements of the tuple. To get all the elements, you don’t have to use the index operator. Use the tuple variable without any index operator to get all elements in the output.


(‘Bihar’, 4, 29, 13)

The above example prints all the elements from the first to the last in the output. There are four elements in the tuple including the string and integer.

Hope, you like this post of how to find first and the last items from the tuple using Python. If you have any query regarding the tutorial, please comment below.

Also tell me, which method you are using to get the last and other elements from tuple using Python.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.