Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Python Negative indexing

# Negative indexing in lists
my_list = ['p','r','o','b','e']

# last item
print(my_list[-1])

# fifth last item
print(my_list[-5])
Source by www.codeproject.com #
 
PREVIOUS NEXT
Tagged: #Python #Negative #indexing
ADD COMMENT
Topic
Name
2+4 =