Answers for "get the last value in a list python"

1

how to get last item in list

# The smart way

list = ["first item", "second item", "third item"]
print(list[len(list) - 1])

# The proper way
print(list[-1])
Posted by: Guest on May-25-2021
5

last element in list py

l = [1,2,3,4,5]
last = l[len(l)-1]
Posted by: Guest on June-29-2020
0

get last item in array python

list = [1, 2, 3]
print(list[-1]) #prints 3
Posted by: Guest on March-11-2021

Code answers related to "get the last value in a list python"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language