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
🌐
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.
Discussions

What's the use of negative indexing?
You want the last element from the list. How would you do it without negative indexing? my_list[len(my_list) - 1] Now this is simpler: my_list[-1] More on reddit.com
🌐 r/learnpython
6
4
January 20, 2021
Negative indexing in Python - Python - Data Science Dojo Discussions
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. For example, in a list with 5 elements, the last element can be accessed using the index -1, the second to ... More on discuss.datasciencedojo.com
🌐 discuss.datasciencedojo.com
1
0
November 9, 2022
What is a Negative Index? - TestMu AI Community
What is a negative index More on community.testmu.ai
🌐 community.testmu.ai
0
October 5, 2023
Negative/signed integer indexing: yay or nay?
There's a better alternative that doesn't seem to be considered often. Let the language provide a type FromEnd that contains a single integer. Let the language provide a value END that contains the integer 0 (maybe use the token $ for this if your language likes that idea). Let the indexing operator be overloaded, such that it can take a value of type integer or a value of type FromEnd. That way, you can type numbers[END-1] == 30 (or numbers[$-1] == 30 perhaps). This avoids the need to repeat the array name, which I find gets very awkward. Also, you can support END-0, which is impossible without the overload. More on reddit.com
🌐 r/ProgrammingLanguages
36
16
September 13, 2021
🌐
Educative
educative.io β€Ί answers β€Ί what-is-negative-indexing-in-python
What is negative indexing in Python?
Line 9: We get the ending negative index of the list using the formula (sizeOfList * -1) - 1. We convert the sizeOfList variable to a negative number (-5) by multiplying it by -1 and adding -1 to iterate till -6 because -6 is not included in ...
🌐
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.
🌐
GeeksforGeeks
geeksforgeeks.org β€Ί python β€Ί python-negative-index-of-element-in-list
Python - Negative index of Element in List - GeeksforGeeks
July 23, 2025 - List is reversed using reversed() ... in the reversed list. Negative index is obtained by negating the result of the index in the reversed list and subtracting one to adjust for the reversed order....
🌐
W3Schools
w3schools.com β€Ί python β€Ί gloss_python_string_negative_indexing.asp
Python String Negative Indexing
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 Β» Β· Python Strings Tutorial ...
🌐
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.
Find elsewhere
🌐
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.
🌐
NumPy
numpy.org β€Ί devdocs β€Ί user β€Ί basics.indexing.html
Indexing on ndarrays β€” NumPy v2.5.dev0 Manual
As in Python, all indices are zero-based: for the i-th index \(n_i\), the valid range is \(0 \le n_i < d_i\) where \(d_i\) is the i-th element of the shape of the array. Negative indices are interpreted as counting from the end of the array (i.e., if \(n_i < 0\), it means \(n_i + d_i\)).
🌐
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 - One of these features is negative indexing, which allows you to access elements of a sequence (such as a list, a string, or a tuple) from the end, using negative numbers as indexes.
🌐
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 - Inside the loop, you check each element of the list to see if it matches the target element element. If you find a match, you calculate the negative index of the element using the formula -len(my_list) + i, where i is the index of the element.
🌐
MicroPython
docs.micropython.org β€Ί en β€Ί latest β€Ί library β€Ί array.html
array – arrays of numeric data β€” MicroPython latest documentation
Indexed read of the array, called as a[index] (where a is an array). Returns a value if index is an int and an array if index is a slice. Negative indices count from the end and IndexError is thrown if the index is out of range.
🌐
StudySmarter
studysmarter.co.uk β€Ί python indexing
Python Indexing: Explained & Techniques | StudySmarter
In Python, indexing follows a zero-based system, which means the first position in a sequence is index 0. Using lists as an example, if fruits = ['apple', 'banana', 'cherry'], then fruits[0] retrieves 'apple'. Negative indices help you retrieve elements from the end.
🌐
Shishirkant
shishirkant.com β€Ί array-indexing-and-slicing-in-python
Array Indexing and Slicing in Python – Shishir Kant Singh
# Python program to demonstrate # the use of index arrays. import numpy as np # Create a sequence of integers from 10 to 1 with a step of -2 a = np.arrange(10, 1, -2) print("\n A sequential array with a negative step: \n",a) # Indexes are specified inside the np.array method.
🌐
Quora
quora.com β€Ί Can-you-use-negative-numbers-as-array-indexes
Can you use negative numbers as array indexes? - Quora
Answer (1 of 2): It depends on your language, and often on the specific situation. In Python, a negative index means to count backward from the end. So, as long as your negative number doesn’t go past the length of the array, it’s legal.
🌐
Quora
quora.com β€Ί How-do-I-see-the-negative-index-of-an-element-in-a-list-in-Python
How to see the negative index of an element in a list in Python - Quora
Answer (1 of 5): [code]test_list = [5, 7, 8, 2, 3, 5, 1] print("The original list is : " + str(test_list)) K = 3 res = len(test_list) - test_list.index(K) # printing result print("The required Negative index : -" + str(res)) [/code]
🌐
Esdiscuss
esdiscuss.org β€Ί topic β€Ί negative-indices-for-arrays
Negative indices for arrays
The syntax is not as important as the semantics at this point, but one more syntax observation: The [:] syntax fits in Python, where a[-1] is the last element of the sequence a. But since we don't want to make that change to JS arrays, this slice syntax is not so attractive. It will mislead Python folks into using negative indexes with property accesses as well as with slices.
🌐
W3Schools
w3schools.com β€Ί python β€Ί numpy β€Ί numpy_array_indexing.asp
NumPy Array Indexing
The second number represents the ... 4 5 6 Since we selected 2, we end up with the third value: 6 Β· Use negative indexing to access an array from the end....