Python string is not mutable, so you can not use the del statement to remove characters in place. However you can build up a new string while looping through the original one:

def reverse(text):
    rev_text = ""
    for char in text:
        rev_text = char + rev_text
    return rev_text

reverse("hello")
# 'olleh'
Answer from akuiper on Stack Overflow
🌐
DigitalOcean
digitalocean.com › community › tutorials › python-reverse-string
Python Reverse String - 5 Ways and the Best One | DigitalOcean
August 3, 2022 - Python String doesn’t have a built-in reverse() function. However, there are various ways to reverse a string in Python. ... Using Slicing to create a reverse copy of the string. Using for loop and appending characters in reverse order · Using while loop to iterate string characters in reverse order and append them
Discussions

Best way to loop over a python string backwards - Stack Overflow
Further investigation shows that re works directly with the memory buffer. So it's impossible to reverse a string for it without copying the data. 2015-08-10T09:17:23.46Z+00:00 ... EDIT: It has been quite some time since I wrote this answer. It is not a very pythonic or even efficient way to loop ... More on stackoverflow.com
🌐 stackoverflow.com
python - Trying to reverse a string using a while loop & other specific conditions - Stack Overflow
So here is the deal, I need to reverse a user-defined string without using [::-1] or a reverse function call. I think I have a found a possible solution but I don't know enough about python to 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
7 proven methods to reverse the python string in 2021
"".join(sorted(a, reverse=True)) will not reverse a string. >>> a = "hello world" >>> "".join(sorted(a, reverse=True)) 'wroolllhed ' There's a deeper problem with articles like this, though. Reversing a string is a trivial task (i.e., it's something for a beginner to learn). Giving seven different methods with no explanation on if one is better than another is not good teaching, especially when some don't even work and others are pointlessly verbose. More on reddit.com
🌐 r/Python
8
0
December 4, 2021
People also ask

How to reverse a string in Python without a reverse function?
You can reverse a string in Python using slicing: reversed_string = original_string[::-1].
🌐
guvi.in
guvi.in › blog › python › python reverse string: 7 effective ways with examples
Python Reverse String: 7 Effective Ways with Examples
Can you use reverse () on a string?
No, the reverse() The method cannot be used on a string in Python, as it is specifically designed for lists.
🌐
guvi.in
guvi.in › blog › python › python reverse string: 7 effective ways with examples
Python Reverse String: 7 Effective Ways with Examples
What is a reversed function in Python?
The reversed() The function in Python returns an iterator that accesses the given sequence in the reverse order. It works with sequences like lists, tuples, and strings.
🌐
guvi.in
guvi.in › blog › python › python reverse string: 7 effective ways with examples
Python Reverse String: 7 Effective Ways with Examples
🌐
Tutorial Gateway
tutorialgateway.org › python-program-to-reverse-string
Python Program to Reverse a String
January 4, 2026 - Inside the loop, add each character at the index position coming from the iteration to a new string. On each iteration, decrement the i value to move towards the first position. # using a while loop a = 'Hello World' b = '' i = len(a) - 1 while ...
🌐
Python Examples
pythonexamples.org › python-reverse-string
Python Program to Reverse a String
With every step of the loop, we extract a character from decreasing end of the string. # Given string x = "Hello World" # Reverse string using While loop x_reversed = '' index = len(x) - 1 while index >= 0: x_reversed = x_reversed + x[index] index = index - 1 # Print reversed string ...
🌐
GUVI
guvi.in › blog › python › python reverse string: 7 effective ways with examples
Python Reverse String: 7 Effective Ways with Examples
January 8, 2026 - def reverse_while_loop(s): s1 = '' length = len(s) - 1 while length >= 0: s1 += s[length] length -= 1 return s1 original_string = "Hello World!" reversed_string = reverse_while_loop(original_string) print("The original string is:", original_string) print("The reversed string using a while loop is:", reversed_string) ... These examples demonstrate the flexibility of using loops to reverse strings in Python.
Find elsewhere
Top answer
1 of 12
125

Try the reversed builtin:

for c in reversed(string):
     print c

The reversed() call will make an iterator rather than copying the entire string.

PEP 322 details the motivation for reversed() and its advantages over other approaches.

2 of 12
10

EDIT: It has been quite some time since I wrote this answer. It is not a very pythonic or even efficient way to loop over a string backwards. It does show how one could utilize range and negative step values to build a value by looping through a string and adding elements in off the end of the string to the front of the new value. But this is error prone and the builtin function reversed is a much better approach. For those readers attempting to understand how reversed is implemented, take a look at the PEP, number 322, to get an understanding of the how and why. The function checks whether the argument is iterable and then yields the last element of a list until there are no more elements to yield. From the PEP:

[reversed] makes a reverse iterator over sequence objects that support getitem() and len().

So to reverse a string, consume the iterator until it is exhausted. Without using the builtin, it might look something like,

def reverse_string(x: str) -> str:
i = len(x)
while i > 0:
    i -= 1
    yield x[i]
    

Consume the iterator either by looping, eg

for element in (reverse_string('abc')): 
    print(element)

Or calling a constructor like:

cba = list(reverse_string('abc'))

The reverse_string code is almost identical to the PEP with a check removed for simplicity's sake. In practice, use the builtin.

ORIGNAL ANSWER:

Here is a way to reverse a string without utilizing the built in features such as reversed. Negative step values traverse backwards.

def reverse(text):
    rev = ''
    for i in range(len(text), 0, -1):
        rev += text[i-1]
    return rev
🌐
GeeksforGeeks
geeksforgeeks.org › python › reverse-string-python-5-different-ways
How to reverse a String in Python - GeeksforGeeks
Python provides a built-in function called reversed() which can be used to reverse the characters in a string. ... If we need more control over the reversal process then we can use a for loop to reverse the string.
Published   4 weeks ago
🌐
Bhrighu
bhrighu.in › blog › reverse-a-string-in-python
How to Reverse a String in Python (5 Easy Methods)
This method demonstrates string ... strings due to repeated string concatenation. Another fundamental approach involves using a while loop to reverse a string through index manipulation....
🌐
Javatpoint
javatpoint.com › how-to-reverse-a-string-in-python
How to reverse a string in Python - Javatpoint
How to reverse a string in Python with python, tutorial, tkinter, button, overview, entry, checkbutton, canvas, frame, environment set-up, first python program, basics, data types, operators, etc.
🌐
GeeksforGeeks
geeksforgeeks.org › python › backward-iteration-in-python
Backward iteration in Python - GeeksforGeeks
July 11, 2025 - This works for lists, tuples, and strings, but not for sets or dictionaries (since they are unordered). ... a = [1, 2, 3, 4, 5] #Loop through the List # reverse order using slicing(::-1) for item in a[::-1]: print(item) # same logic written using List comprehension # [print(item) for item in a[::-1]] ... Using a while loop provides you control over the iteration process.
🌐
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) // Unstop
December 21, 2023 - For this, we find the length of ... it. After that, we define a while loop to iterate through the characters of the original string in reverse order and assign the result to the reversed_string variable....
🌐
Quora
quora.com › How-do-I-use-Python-to-reverse-a-string
How to use Python to reverse a string - Quora
Answer (1 of 8): Hi, Some of the common ways to reverse a string are: * Using Slicing to create a reverse copy of the string. * Using for loop and appending characters in reverse order * Using while loop to iterate string characters in reverse order and append them * Using string join() fun...
🌐
Real Python
realpython.com › reverse-string-python
Reverse Strings in Python: reversed(), Slicing, and More – Real Python
July 31, 2023 - The first technique you’ll use to reverse a string involves a for loop and the concatenation operator (+). With two strings as operands, this operator returns a new string that results from joining the original ones.
🌐
Linode
linode.com › docs › guides › how-to-reverse-a-string-in-python
How to Reverse a String in Python | Linode Docs
May 13, 2022 - The value should be reduced by one with each iteration of the loop, and the loop should end when the value passes zero. By the end of the loop, the code has walked through each index in the string from the end to the beginning. The Python code below uses a while loop to iterate through the string “doom wolf” and adds the reversed string to the reversed_string variable.
🌐
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 - Here’s an example of reversing a string in Python using Loop: This code iterates over the original string from the last character to the first, adding each character to a new string. The range() function creates a sequence of indices in reverse order. You can also utilize the ‘while loop’ in this method.
🌐
Flexiple
flexiple.com › python › python-reverse-string
Reverse String In Python - Flexiple
March 18, 2024 - To reverse a string in Python using a loop, follow these steps. First, initialize an empty string that will hold the reversed string. Then, use a loop to iterate over the original string, adding each character to the beginning of the new string.
🌐
YouTube
youtube.com › shorts › OXsi3-UTBg0
#Python Reverse a String Using For Loop. - YouTube
#Python Reverse a String Using For Loop. #datascience #programming #coding 👉SQL Shorts Playlist:https://youtube.com/playlist?list=PL2DNwXX2LoZtW2fgoh-5wF-_z...
Published   January 25, 2025