import random
random_no = random.sample(range(100), 100). #created the 100 elements list
random_no #printing the elements
random_no[len(random_no)-1] #accessed the last elements
I used random.sample to create a 100 elements list to show you how to retrieve the last element.
And accessed the last element using len() function minus 1. (because the indexing starts from 0).
I think this answered your question. If you still got any query. Do post in the comments.
Get Answers For Free
Most questions answered within 1 hours.