Page 85 - Modular v1.1 Pyhton
P. 85
Program 4: To do indexing in a tuple.
On running the above program, you will get the following output:
Negative Indexing
The negative indexing means searching for elements by using the index (position) from the ends.
This means that the last element of the array is the first element in the negative indexing which is
-1. The index -1 refers to the last element, -2 indexes refers to the second last element, and so on.
Program 5: To do negative indexing.
On running the above program, you will get the following output:
Tuple Slicing
To access the certain range of tuple elements the slicing operator [:] is used.
Program 6: To slice a tuple.
Tuple in Python 83

