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
 
PREVIOUS NEXT
Tagged: #element #list #python
ADD COMMENT
Topic
Name
4+2 =