Negative numbers mean that you count from the right instead of the left. So, list[-1] refers to the last element, list[-2] is the second-last, and so on.

Answer from Toomai on Stack Overflow
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ gloss_python_string_negative_indexing.asp
Python String Negative Indexing
โฎ Python Glossary ยท Use negative indexes to start the slice from the end of the string: Get the characters from position 5 to position 1, starting the count from the end of the string: b = "Hello, World!" print(b[-5:-2]) Try it Yourself ยป ...
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ what-is-negative-indexing-in-python
What is Negative Indexing in Python? - GeeksforGeeks
July 23, 2025 - Negative indexing in Python allows us to access elements from the end of a sequence like a list, tuple, or string.
๐ŸŒ
Medium
medium.com โ€บ @journalehsan โ€บ what-is-negative-indexing-in-python-and-how-to-use-it-34ec7ac5b36
What is Negative Indexing in Python and How to Use It? ๐Ÿ | by Ehsan Tork | Medium
June 9, 2023 - The answer is simple: Python adds the length of the sequence to the negative index to get the corresponding positive index. For example, if you have a list with four elements and you use an index of -1, Python will add 4 (the length of the list) ...
๐ŸŒ
Educative
educative.io โ€บ answers โ€บ what-is-negative-indexing-in-python
What is negative indexing in Python?
Negative indexing retrieves elements from the end by providing negative numbers as sequence indexes.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python-negative-index-of-element-in-list
Python - Negative index of Element in List - GeeksforGeeks
January 29, 2025 - When the element is found the negative index is calculated by subtracting the current index from the total length of the list ensuring the result is in negative form. ... The task of removing negative elements from a list in Python involves ...
๐ŸŒ
Python.org
discuss.python.org โ€บ python help
Negative indexing python code - Python Help - Discussions on Python.org
June 11, 2025 - If anyone can please explain how the code in red square exactly works.
Find elsewhere
๐ŸŒ
Execute Program
executeprogram.com โ€บ courses โ€บ python-for-programmers โ€บ lessons โ€บ negative-indexing
Python for Programmers: Negative Indexing
Learn programming languages like TypeScript, Python, JavaScript, SQL, and regular expressions. Interactive with real code examples.
๐ŸŒ
AskPython
askpython.com โ€บ python โ€บ list โ€บ negative-indexing
Negative Indexing in Python List - How to Use "-1" Parameter - AskPython
April 4, 2023 - The process of indexing from the opposite end is called Negative Indexing. In negative Indexing, the last element is represented by -1. ... We have a built-in function reverse() in Python to reverse a list, letโ€™s take a look.
๐ŸŒ
i2tutorials
i2tutorials.com โ€บ home โ€บ blogs โ€บ what are negative indexes and why are they used?
What are negative indexes and why are they used? | i2tutorials
January 13, 2022 - But no programming language allows us to use a negative index value such as -4. Python programming language supports negative indexing of arrays, something which is not available in arrays in most other programming languages.
๐ŸŒ
EITCA
eitca.org โ€บ home โ€บ how do negative indexes work in python when accessing elements in a list?
How do negative indexes work in Python when accessing elements in a list? - EITCA Academy
August 3, 2023 - In Python, lists are zero-indexed, meaning that the first element is at index 0, the second element at index 1, and so on. Negative indexes, on the other hand, start from -1, where -1 represents the last element in the list, -2 represents the second-to-last element, and so forth.
๐ŸŒ
Spark By {Examples}
sparkbyexamples.com โ€บ home โ€บ python โ€บ negative index of list in python
Negative Index of List in Python - Spark By {Examples}
May 31, 2024 - How to get a negative index of an element from the list in Python? A negative index of a list in Python refers to accessing elements in a list by counting
๐ŸŒ
Codingem
codingem.com โ€บ home โ€บ negative indexing in python: a step-by-step guide (examples)
Negative Indexing in Python: A Step-by-Step Guide (Examples)
November 1, 2022 - Python indexing can be started from the end of the iterable. This is called negative indexing. -1 is the last value, -2 is the 2nd last.
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ what-is-a-negative-indexing-in-python
What is a Negative Indexing in Python?
August 25, 2023 - Negative indexing in Python allows you to access elements from the end of a sequence (string, list, tuple) by using negative numbers. Instead of counting from the beginning (0, 1, 2...), negative indexing counts backwards from the last element (-1,
๐ŸŒ
Data Science Dojo
discuss.datasciencedojo.com โ€บ python
Negative indexing in Python - Python - Data Science Dojo Discussions
November 9, 2022 - Negative indexes refer to the positions of elements within an array-like object such as a list, tuple, or string, counting from the end of the data structure rather than the beginning.
๐ŸŒ
LabEx
labex.io โ€บ tutorials โ€บ python-how-to-use-negative-indexing-in-python-lists-418588
How to use negative indexing in Python lists | LabEx
LabEx encourages continuous practice to improve your Python skills. List slicing allows you to extract a portion of a list using negative indices, providing powerful and flexible data manipulation techniques. ## General syntax: list[start:end:step] numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] ## Negative index slicing examples print(numbers[-5:]) ## Last 5 elements print(numbers[-7:-2]) ## Slice from 7th to 2nd last element
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ article โ€บ python-negative-index-of-element-in-list
Python โ€“ Negative index of Element in List
March 26, 2026 - Python allows negative indexing where -1 refers to the last element, -2 to the second last, and so on.
๐ŸŒ
DEV Community
dev.to โ€บ hichem-mg โ€บ negative-indexing-in-python-with-examples-1ind
Negative Indexing in Python, with Examples ๐Ÿ - DEV Community
June 9, 2024 - In this tutorial, I will go through what negative indexing is, how it works, and its practical applications in Python programming.