That is simply because how indexing works in Python.

s[-1: -9: -1] has 8 characters just like s or s[0: 9: 1] has 8 characters. The last index is always ignored. This is done so that things like range(n) have, like the call suggests, n terms although it goes from 0 to n-1.

It is clearer if you forget numbers altogether and just look at this object: s[0: len(s): +1]. Reverse the sign of the indexes and substract -1 to get the opposite string s[-0-1: -len(s)-1: -1].

Answer from Guimoute on Stack Overflow
🌐
Real Python
realpython.com › reverse-string-python
Reverse Strings in Python: reversed(), Slicing, and More – Real Python
March 18, 2026 - Note: Since Python strings are immutable data types, you should keep in mind that the examples in this section use a wasteful technique. They rely on creating successive intermediate strings only to throw them away in the next iteration. If you prefer using a while loop, then here’s what you can do to build a reversed copy of a given string: ... >>> def reversed_string(text): ... result = "" ... index = len(text) - 1 ...
Discussions

Reverse String through indices. | Python Language Forum
Reverse String through indices. More on whizdomtraining.com
🌐 whizdomtraining.com
Why does [::1] reverse a string in Python?
On July 1st, a change to Reddit's API pricing will come into effect. Several developers of commercial third-party apps have announced that this change will compel them to shut down their apps. At least one accessibility-focused non-commercial third party app will continue to be available free of charge. If you want to express your strong disagreement with the API pricing change or with Reddit's response to the backlash, you may want to consider the following options: Limiting your involvement with Reddit, or Temporarily refraining from using Reddit Cancelling your subscription of Reddit Premium as a way to voice your protest. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns. More on reddit.com
🌐 r/learnprogramming
15
12
September 21, 2023
python - string reversal function using reversed indexing - Stack Overflow
Suggestion: There is simpler way to reverse the string using ::-1. More on stackoverflow.com
🌐 stackoverflow.com
iterate over a string in reverse
https://docs.python.org/3/library/functions.html#reversed More on reddit.com
🌐 r/learnpython
7
1
February 7, 2023
🌐
GeeksforGeeks
geeksforgeeks.org › python › reverse-string-python-5-different-ways
How to reverse a String in Python - GeeksforGeeks
Reverse the string by iterating over its indices in reverse order using range(). The list comprehension collects characters from last to first, and join() combines them into the final reversed string.
Published: March 3, 2026
🌐
Mkyong
mkyong.com › home › python › how to reverse a string in python
How to reverse a string in Python - Mkyong.com
June 4, 2020 - string = "abcdefghijk" print("".join(reversed(string))) ... This Python code is for good educational purposes, it loops element from the last index to the beginning index, and puts it into a list, in the end, join the list and return a string.
🌐
Educative
educative.io › answers › how-do-you-reverse-a-string-in-python
How do you reverse a string in Python?
Three methods to reverse a string are explained below: Strings can be reversed using slicing. To reverse a string, we simply create a slice that starts with the length of the string, and ends at index 0.
🌐
Linuxize
linuxize.com › home › python › how to reverse a string in python
How to Reverse a String in Python | Linuxize
August 1, 2021 - In Python, a string is a sequence of Unicode characters. Though Python supports numerous functions for string manipulation, it doesn’t have an inbuilt function or method explicitly designed to reverse the string.
Find elsewhere
🌐
Whizdomtraining
whizdomtraining.com › python-training › forum › 7777 › reverse-string-through-indices
Reverse String through indices. | Python Language Forum
The fastest (and easiest) way is to use a slice that steps backwards, -1. print(mystr[ : :-1]) start = 0 stop = 19 # slicing from index start to index stop-1 print(mystr[start:stop]) # slicing from index start to the end print(mystr[start:]) ...
🌐
TutorialsPoint
tutorialspoint.com › article › How-to-search-a-string-in-backwards-direction-in-Python
How to search a string in backwards direction in Python?
The given string is: Welcome to Tutorialspoint Finding the last index of Hello -1 Substring not found · Here's an example showing how both methods handle multiple occurrences ? text = "Python is great, Python is powerful" substring = "Python" print("String:", text) print("Using rfind():", text.rfind(substring)) print("Using rindex():", text.rindex(substring)) # Show all occurrences for comparison print("All occurrences:") start = 0 while True: pos = text.find(substring, start) if pos == -1: break print(f"Found at index: {pos}") start = pos + 1
🌐
LogRocket
blog.logrocket.com › home › 5 methods to reverse a python string
5 methods to reverse a Python string - LogRocket Blog
June 4, 2024 - new_string = '' ... count = len(input_string) - 1 ... while count >= 0: ... new_string = new_string + input_string[count] ... count = count - 1 ... return new_string >>> w_reverse('?uoy era woH') 'How are you?' Here, we are creating a function and initializing a new variable, the same as the previous example · Now we take the length of the input string and subtract it by 1 because the index in Python starts from 0.
🌐
24HourAnswers
24houranswers.com › technical-tutoring-tips › How-to-Reverse-a-String-in-Python
How to Reverse a String in Python
October 13, 2021 - This example is 11 characters long ... with each iteration; this will let the while loop continue for 11 iterations. reversed_string += string[index]This shows you how to use the += operator, which performs a straightforward sum ...
🌐
Vultr Docs
docs.vultr.com › python › standard-library › str › rindex
Python str rindex() - Find Substring Reverse | Vultr Docs
December 31, 2024 - The rindex() method in Python’s string class can be incredibly useful for finding the last occurrence of a substring within another string. This method is particularly helpful when you need to determine the position of a substring from the ...
🌐
DigitalOcean
digitalocean.com › community › tutorials › python-reverse-string
Python Reverse String - 5 Ways and the Best One | DigitalOcean
Technical tutorials, Q&A, events — This is an inclusive place where developers can find or lend support and discover new ways to contribute to the community.
🌐
Analytics Vidhya
analyticsvidhya.com › home › 5 ways to reverse a string in python
How to Reverse a String in Python in 5 Ways | Reverse Function
February 5, 2025 - A. To reverse part of a string in Python, you can concatenate slices of the string: part_reversed = my_string[:start_index] + my_string[end_index:start_index:-1] + my_string[end_index:]
🌐
Reddit
reddit.com › r/learnprogramming › why does [::1] reverse a string in python?
r/learnprogramming on Reddit: Why does [::1] reverse a string in Python?
September 21, 2023 -

For example:

txt = "Hello World"[::-1]

Isn't the splice syntax [start : stop: step]? And default of start and stop are the beginning and end of the string? So that would make the above start at the beginning, stop at the end, but step by -1. That feels like it would start at the beginning, then step backwards to...before the beginning of the string?

Sorry for the silly question, I just can't figure out why this syntax works the way it does.

🌐
GeeksforGeeks
geeksforgeeks.org › python-reverse-slicing-of-given-string
Python - Reverse Slicing of given string - GeeksforGeeks
January 14, 2025 - Sometimes we need to manipulate our string to remove extra information from the string for better understanding and faster processing. Given a task in which the substring needs to be removed from the end of the string using Python. Â Â Remove the substring from the end of the string using Slicing In ... Given a string list, reverse each element of string list from ith to jth index.
🌐
Hero Vired
herovired.com › learning-hub › topics › how-to-reverse-a-string-in-python
How to Reverse a String in Python - Hero Vired Topics
July 17, 2024 - # reverse a string using while loop # declare initial string initial_string = "Hello, Python Lovers!" reversed_string = '' # defining a counter counter = len(initial_string) - 1 # using while loop to start iteration from last index of initial string # and creating reversed string while counter >= 0: reversed_string += initial_string[counter] counter -= 1 print("Initial String is :", initial_string) print("Reversed String is :", reversed_string)
🌐
Unstop
unstop.com › home › blog › how to reverse a string in python in 10 ways! (code)
How To Reverse A String In Python In 10 Ways! (Code)
December 21, 2023 - Inside the loop, we access each character of the original_string using the index i and concatenate it to the reversed_string. By doing this in reverse order, we gradually build the reversed version of the original string.