How to Access Tuple Items in Python


In this example, we will learn how to access tuple items by referring to the index number in Python.

Source Code

# the tuples are written with round brackets
my_tuple = ('a', 'b', 1, 2)

print(my_tuple[2])

Output:

1

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
Advertisement