May 2017
Intermediate to advanced
280 pages
6h 2m
English
In order to access a particular value of tuple, specify a position number, in brackets. Let's discuss with an example. I am going to make a tuple of the heroes from the movie Avengers.
>>> Avengers = ("iron-man", "vision", "Thor", "hulk")>>> Avengers[0]'iron-man'>>> Avengers[2]'Thor'>>> >>> Avengers[-1]'hulk'>>>
The following diagram will clear the doubts:

Now you can see positive and negative indexing.
Read now
Unlock full access