How to Access Tuple Items with a Range of Indexes in Python


In this example we will show how to access tuple items by specifying a range of indexes in Python.

Source Code

my_tuple = ('a', 'b', 'c', 'd', 1, 2, 3, 4)

print(my_tuple[1:6])

Output:

('b', 'c', 'd', 1, 2)
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments