1# To get the last element in a list you use -1 as position
2bikes = ['trek', 'redline', 'giant']
3bikes[-1]
4# Output:
5# 'giant'
1def list_rindex(li, x):
2 for i in reversed(range(len(li))):
3 if li[i] == x:
4 return i
5 raise ValueError("{} is not in list".format(x))