Answers for "get last element of list"

3

get last element of a list python

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

print(a[-2])
#prints: 3
Posted by: Guest on January-16-2021
1

how to print last element in a list python

lis[len(lis)-1]
Posted by: Guest on August-19-2020

Code answers related to "get last element of list"

Python Answers by Framework

Browse Popular Code Answers by Language