Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Accessing element using negative indexing

List = [1, 2, 'Softhunt', 4, '.net', 6, 'Tutorials']
 
# accessing an element using
# negative indexing
print("Accessing element using negative indexing")
 
# print the last element of list
print(List[-1])
 
# print the third last element of list
print(List[-5])
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #Accessing #element #negative #indexing
ADD COMMENT
Topic
Name
4+5 =