Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

-2 in python

# assuming you were not looking for the number -2
# -2 as an index to an array-like object (as a list) will return
# its second-to-last element

# Here is an example
l = [1,27,34,5,6,7,5,84,289,63,52]
print(l[-2])
>>> 63
 
PREVIOUS NEXT
Tagged: #python
ADD COMMENT
Topic
Name
9+3 =