Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

negative index in Python list

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

# last item
print(my_list[-1])
#e
# fifth last item
print(my_list[-5])
#p
Source by www.howtouselinux.com #
 
PREVIOUS NEXT
Tagged: #negative #index #Python #list
ADD COMMENT
Topic
Name
3+4 =