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
Discussions

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
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
🌐
Real Python
realpython.com › reverse-string-python
Reverse Strings in Python: reversed(), Slicing, and More – Real Python
July 31, 2023 - 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 ...
🌐
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.
🌐
datagy
datagy.io › home › python posts › python strings › python reverse string: a guide to reversing strings
Python Reverse String: A Guide to Reversing Strings • datagy
March 3, 2023 - If it’s a string, we use string indexing to return the reversed text. If the argument is a string, we raised a TypeError and return a custom message indicating that you need to pass in a string. Why is this method good? This method makes it incredibly clear that we want to reverse a string. This is especially helpful for beginners who may need a bit of help following the code. In the following sections, we’ll explore different ways in which you can reverse a string in Python.
🌐
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
July 26, 2023 - 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
🌐
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.
🌐
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 ...
🌐
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.
🌐
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:]
🌐
DigitalOcean
digitalocean.com › community › tutorials › how-to-index-and-slice-strings-in-python-3
How To Index and Slice Strings in Python | DigitalOcean
September 29, 2025 - # Using reversed() and join() reversed_text = ''.join(reversed(text)) # Using a loop (less efficient) reversed_text = '' for char in text: reversed_text = char + reversed_text · The slicing method [::-1] is generally preferred because it’s concise, readable, and efficient. In this tutorial, we’ve explored the fundamental concepts of indexing and slicing strings in Python 3, which are crucial for manipulating text data.
🌐
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.

🌐
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.
🌐
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.
🌐
Hostman
hostman.com › tutorials › how-to-reverse-a-string-in-python
How to Reverse a String in Python | Step-by-Step Guide
If we want to reverse a string using the basic programming structures without utilizing a built-in function, we can achieve this with traditional Python for loop. We can use the for loop to iterate over our string in the opposite direction from the last index to the first 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)