Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

get last element of a list python

a = [1, 2, 3, 4]
print(a[-1])
#prints: 4

print(a[-2])
#prints: 3
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #element #list #python
ADD COMMENT
Topic
Name
7+7 =