Home / Python Tips Generated By ChatGPT / Negative Indexing in Lists in Python Access elements from the end of a list using negative indices. Source Code my_list = [10, 20, 30, 40, 50] last_item = my_list[-1] # 50 second_last = my_list[-2] # 40 print(f"Last item: {last_item}, Second to last: {second_last}")