The top of the page seems to offer a pretty good (and visual!) explanation, really. What the red box seems to be demonstrating is that you can mix and match postive and negative indices when slicing a string. Even in an otherwise unintuitive way. If you look at the illustration at the top, itโ€™s cleโ€ฆ Answer from mart-r on discuss.python.org
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ what-is-negative-indexing-in-python
What is Negative Indexing in Python? - GeeksforGeeks
July 23, 2025 - Negative Indexing: Starts from -1 for the last element and goes up to -n for the first element. ... # Using negative indexing in a list a = [10, 20, 30, 40, 50] # Accessing elements from the end print(a[-1]) # last element print(a[-2]) # second ...
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ gloss_python_string_negative_indexing.asp
Python String Negative Indexing
Python Examples Python Compiler ... ยท 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 ...
Discussions

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
python - Negative list index? - Stack Overflow
@abought That is solely because ... element with the index specified after the colon! -1 still refers to the last value in the list. 2020-05-28T11:47:00.76Z+00:00 ... Save this answer. ... Show activity on this post. List indexes of -x mean the xth item from the end of the list, so n[-1] means the last item in the list n. Any good Python tutorial should ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
Lol, python uses 0-based indexing, but 1-based negative indexing.

The negative index starts at the beginning of the array too. So you have to go negative one more step to pass the last element.

0 1 2 3
a b c

In the illustration a is indexed [0] by the number to the left of it. If you count backwards:

-3 -2 -1 -0  1  2  3
a b c a b c

Here c is index -1 by the number to the left of it as well. It is consistent behavior.

More on reddit.com
๐ŸŒ r/ProgrammerHumor
5
0
April 28, 2018
Regarding list slicing: can anyone help me understand the reasoning behind inclusive vs. exclusive indexing with negative vs. non-negative integers?
[-1] refers to the last element, so list[0:-1] gives you all but the last element in the same exclusive manner as you saw with positive indices. More on reddit.com
๐ŸŒ r/learnpython
10
5
April 27, 2019
๐ŸŒ
DEV Community
dev.to โ€บ hichem-mg โ€บ negative-indexing-in-python-with-examples-1ind
Negative Indexing in Python, with Examples ๐Ÿ - DEV Community
June 9, 2024 - Negative indexing is a powerful feature in Python that allows you to access elements from the end of a sequence. Instead of starting from 0, negative indices start from -1, which corresponds to the last element of the sequence.
๐ŸŒ
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 ... 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) to -1 (the index) and get 3 (the positive index)....
๐ŸŒ
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 - For instance, letโ€™s get the last three names from the list: names = ["Alice", "Bob", "Charlie", "David", "Emmanuel", "Fiona"] last_three = names[-3:] print(last_three) ... Negative slicing also supports negative step size.
๐ŸŒ
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 ...
Find elsewhere
๐ŸŒ
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 - Slicing with negative indexes works in the same way as slicing with positive indexes, but the start and end points are specified relative to the end of the list. For example, if we want to extract the last three elements of the list, we can use the slice -3: (which is equivalent to [3, 4, 5]):
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python-negative-index-of-element-in-list
Python - Negative index of Element in List - GeeksforGeeks
January 29, 2025 - For example, we are having a list li = [10, 20, 30, 40, 50] and the given element is 30 we need to fin the negative index of it so that given output should be -3. index() method in Python searches for the first occurrence of a specified element ...
๐ŸŒ
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.
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ what-is-a-negative-indexing-in-python
What is a Negative Indexing in Python?
August 25, 2023 - Instead of counting from the beginning (0, 1, 2...), negative indexing counts backwards from the last element (-1, -2, -3...). In a string like "Python", the negative indices work as follows ? # Basic slicing syntax sequence[start:stop:step] # Examples with negative indexing sequence[-4:-1] # From 4th last to 2nd last sequence[-5:] # From 5th last to end sequence[:-2] # From beginning to 3rd last sequence[::-1] # Reverse entire sequence
๐ŸŒ
How to Use Linux
howtouselinux.com โ€บ home โ€บ understanding negative index in python
Understanding negative index in Python - howtouselinux
October 9, 2025 - For example, if we have a list of numbers: ... >>> my_list[0] # Get the first element in the list >>> my_list[-1] # Get the last element in the list ยท As you can see, we use the โ€“ sign to denote that we want to start counting from the end of the list. ... The first one will be significantly ...
๐ŸŒ
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
๐ŸŒ
Knowledgehills
knowledgehills.com โ€บ python โ€บ negative-indexing-slicing-stepping-comparing-lists.htm
Python Lists โ€“ Negative Indexing, Slicing, Stepping, Comparing, Max and Min โ€“ Knowledge Hills
lst = ['Ajay', 'Bobby','Ashok', 'Vijay', 'Anil', 'Rahul','Alex', 'Christopher'] print (lst[1:]) print (lst[0:]) print (lst[2:-2]) # all elements starting from third element but skips the last two elements. print (lst[::2]) # this will print all alternate elements (begin to end in steps of 2) ...
๐ŸŒ
AlgoCademy
algocademy.com โ€บ link
Negative Index in Python | AlgoCademy
Unlike other languages, Python does not throw an error when we try to access list elements with negative indexes. For example, we can use the index -1 to select the last element of a list, even when we donโ€™t know how many elements are in a list:
๐ŸŒ
Finxter
blog.finxter.com โ€บ home โ€บ learn python blog โ€บ negative indexing in python
What is Negative Indexing in Python? - Be on the Right Side of Change
November 11, 2023 - For example, pop(-1) removes the last element of the list. Common mistakes include using an index thatโ€™s too negative, resulting in IndexError, or forgetting that -1 is the last item, not -0 (as -0 is the same as 0 in Python).
๐ŸŒ
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 ... beginning. For example, in a list with 5 elements, the last element can be accessed using the index -1, the second to last element using the index -2, and so on....
๐ŸŒ
YouTube
youtube.com โ€บ watch
Negative Indexing in Python Lists with Example - YouTube
In this video, learn what is Negative Indexing in Python Lists with examples. Lists in Python are ordered. It is modifiable and changeable, unlike Tuples. Py...
Published: August 19, 2022
๐ŸŒ
OpenGenus
iq.opengenus.org โ€บ negative-index-in-python
Negative Index in Python
December 7, 2022 - #list definition test_list = [0, 1, 2, 3, 4, 5, 6] #Slicing the list with negative index #Assigning the new list to a variable sliced_list = test_list [-5:-1] #Returns the new list print(sliced_list) ...