How do I get the last element of a list?
If you only want to peek at the last element without modifying the list, negative indexing (my_list[-1]) is still the best and most Pythonic choice free online games. Just remember to always check if the list is empty first to avoid an IndexError.
Answered Aug 13, 2026 · 1.1K Views Read answer →