Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Python Negative Indexing

# Negative indexing for accessing tuple elements
my_tuple = ('p', 'e', 'r', 'm', 'i', 't')

# Output: 't'
print(my_tuple[-1])

# Output: 'p'
print(my_tuple[-6])
Source by www.codegrepper.com #
 
PREVIOUS NEXT
Tagged: #Python #Negative #Indexing
ADD COMMENT
Topic
Name
4+4 =