1# To get the last element in a list you use -1 as position
2bikes = ['trek', 'redline', 'giant']
3bikes[-1]
4# Output:
5# 'giant'
1mylist = [0, 1, 2]
2mylist[-1] = 3 # sets last element
3print(myList[-1]) # prints Last element
1>>> some_list = [1, 2, 3]
2>>> some_list[-1] = 5 # Set the last element
3>>> some_list[-2] = 3 # Set the second to last element
4>>> some_list
5[1, 3, 5]