Access Tuple Item by Index :
thistuple = ("apple", "banana", "cherry")
print(thistuple[1])
Output :
banana
Negative Indexing in Tuple :
thistuple = ("apple", "banana", "cherry")
print(thistuple[-1])
Output :
cherry
Tuple Range Indexing :
thistuple = ("apple", "banana", "cherry", "orange", "kiwi", "melon", "mango")
print(thistuple[2:5])
Output :
('cherry', 'orange', 'kiwi')
Tuple Range Without Start Index :
thistuple = ("apple", "banana", "cherry", "orange", "kiwi", "melon", "mango")
print(thistuple[:4])
Output :
('apple', 'banana', 'cherry', 'orange')
Tuple Range Without End Index :
thistuple = ("apple", "banana", "cherry", "orange", "kiwi", "melon", "mango")
print(thistuple[2:])
Output :
('cherry', 'orange', 'kiwi', 'melon', 'mango')