Page 3 - Lesson Note - TUPLES
P. 3
Nested tuple
Nesting of list/string/tuple itself can be done inside a tuple:
Accessing Tuple Elements
If the tuple is:
T = (10, 12, 15, 20, 25, 32, 37, 40)
Elements of tuple can be accessed by it’s index, same as list.
forward index 0 1 2 3 4 5 6 7
10 12 15 20 25 32 37 40
backward index -8 -7 -6 -5 -4 -3 -2 -1
If it is a nested tuple:
Operations on Tuples
➢ Concatenation
➢ Replication
➢ Membership Testing
➢ Slicing
➢ Indexing