python how to get the last element in a list

33

some_list = [1, 2, 3]
some_list[-1]
print(some_list)
#Output = 3
list1 = [1, 2, 3, 4, 5]
print(list1[len(list1)-1])
print(list1[-1])
print(list1.pop())

Comments

Submit
0 Comments