Access Tuple Item by Index :

thistuple = ("apple", "banana", "cherry")
print(thistuple[1])  # Access item at index 1

Output :

banana

Negative Indexing in Tuple :

thistuple = ("apple", "banana", "cherry")
print(thistuple[-1])  # Access last item

Output :

cherry

Tuple Range Indexing :

thistuple = ("apple", "banana", "cherry", "orange", "kiwi", "melon", "mango")
print(thistuple[2:5])  # Get slice from index 2 to 4

Output :

('cherry', 'orange', 'kiwi')

Tuple Range Without Start Index :

thistuple = ("apple", "banana", "cherry", "orange", "kiwi", "melon", "mango")
print(thistuple[:4])  # From start till index 3

Output :

('apple', 'banana', 'cherry', 'orange')

Tuple Range Without End Index :

thistuple = ("apple", "banana", "cherry", "orange", "kiwi", "melon", "mango")
print(thistuple[2:])  # From index 2 till end

Output :

('cherry', 'orange', 'kiwi', 'melon', 'mango')