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

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
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
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
What's the best way to reverse a string in Python?
Dunno about best, but using string splicing is an easy way to do it. s=s[::-1] It works by doing [start:end:step] - by leaving begin and end off and specifying a step of -1, it reverses a string More on reddit.com
🌐 r/Python
17
4
January 9, 2018
🌐
Flexiple
flexiple.com › python › python-reverse-string
Reverse String In Python - Flexiple
March 18, 2024 - Then, use a loop to iterate over the original string, adding each character to the beginning of the new string. This effectively reverses the order of the characters. original_string = "Hello" reversed_string = "" for ...
🌐
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. You can reverse Python string using a for loop by iterating over the string in reverse order and concatenating each character: reversed_string = ” for char in my_string[::-1]: reversed_string += char
🌐
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
🌐
Quora
programmerprogramming.quora.com › How-to-Reverse-string-in-python-using-for-loop-See-2-different-methods-to-reverse-string-using-for-loop-python-pyt
How to Reverse string in python using for loop? See 2 different methods to reverse string using for loop. #python #pythontutorial #prog...
How to Reverse string in python using for loop? See 2 different methods to reverse string using for loop. #python #pythontutorial #programming #coding https://codingforbeginnersbinaryburst.quora.com/How-to-reverse-a-string-in-python-using-for-loop-1
🌐
Python Examples
pythonexamples.org › python-reverse-string
Python - Reverse String
In this example, we will reverse a string using Python For Loop. With for loop, we iterate over characters in string and append each character at the front of a new string(initially empty). By the end of the for loop, we should have a reversed string. # Given string x = "Hello World" # Reverse ...
Find elsewhere
🌐
EyeHunts
tutorial.eyehunts.com › home › how to reverse a string in python using for loop | example code
How to reverse a string in Python using for loop | Example code
January 13, 2023 - Note: Python string is not mutable, but you can build up a new string while looping through the original one: ... The for loop iterated every element of the given string, join each character in the beginning, and store it in the variable. def ...
🌐
Tutorial Gateway
tutorialgateway.org › python-program-to-reverse-string
Python Program to Reverse a String
January 4, 2026 - For Loop First Iteration: for i in st1 => for C in Coding str2 = C + st2=> C + ” · Second Iteration: for o in Coding st2 = o + C => oC · 3rd Iteration: for d in Coding st2 = d + oC => doC · Apply the same logic for the remaining iterations.
🌐
YouTube
youtube.com › watch
Three Ways to Reverse a String in Python TUTORIAL (using For Loops, reversed(), and Slice Notation) - YouTube
Python tutorial on 3 ways to reverse a string.This is a common python interview question. 📖 You can check out the Udemy course (Python Built-in Functions) h...
Published   August 5, 2019
🌐
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 - ... The concept of recursion is a powerful technique in programming, and it can also be employed to reverse a string. For this, we can define a function and recursively call it to add the last index character of the string on a loop.
🌐
wikiHow
wikihow.tech › computers and electronics › software › programming › python › 6 ways to reverse a string in python: easy guide + examples
6 Ways to Reverse a String in Python: Easy Guide + Examples
March 20, 2023 - Alternatively, use a For loop or the reversed() function for additional flexibility in the reversal process. You can also use the join() function or a list to make a string backwards.
🌐
GUVI
guvi.in › blog › python › python reverse string: 7 effective ways with examples
Python Reverse String: 7 Effective Ways with Examples
January 8, 2026 - In this example, the reverse_string function takes an input string, applies the reversed() function to create an iterator, and then uses "".join() to form the reversed string. This method is straightforward and leverages Python’s powerful built-in functions to perform the task efficiently. By understanding and utilizing these techniques, you can effectively reverse strings in Python, enhancing both the readability and performance of your code. Reversing strings using loops in Python is a straightforward method that can be accomplished either through a for loop or a while loop.
🌐
Upgrad
upgrad.com › home › tutorials › software & tech › reverse string in python
Reverse a String in Python – Using Loops, Slicing & Functions
May 13, 2026 - For each index `i`, `original_string[i]` accesses the character at that position, and we prepend it to the `reversed_string` to build the string in reverse order. This approach offers clear control over the index and is easy to follow, making ...
🌐
Python Guides
pythonguides.com › python-program-to-reverse-a-string
How To Reverse A String In Python?
January 12, 2026 - original_string = "Texas" reversed_string = '' for char in original_string: reversed_string = char + reversed_string print(reversed_string) # Output: saxeT · You can see the output in the screenshot below. Using a loop gives you full control over the reversal process and helps you understand string manipulation and logic in Python. Recursion can also be used to reverse a string in Python.
🌐
Guru99
guru99.com › home › python › how to reverse a string in python (5 methods)
How to reverse a String in Python (5 Methods)
3 weeks ago - Reversing a string in Python uses five proven techniques: a for loop, a while loop, slice notation [::-1], the reversed() function, and recursion.
🌐
Pdxdev
python.pdxdev.com › strings › how-to-reverse-a-string-in-python-using-for-loop
Reversing Strings in Python Using For Loops
Cryptography: Some encryption algorithms involve reversing strings as part of their process. Python’s for loop allows us to iterate over each character in a string.
🌐
Linode
linode.com › docs › guides › how-to-reverse-a-string-in-python
How to Reverse a String in Python | Linode Docs
May 13, 2022 - You need to # subtract one from the length, since Python indices start at zero. string_working_index = len(example_string) - 1 # Start a loop that ends when the index gets below zero. while string_working_index >= 0: # Use the index to add a character from the original string to # the reversed string. reversed_string += example_string[string_working_index] # Reduce the index by one to continue progressing backward # through the string. string_working_index -= 1 print(reversed_string) ... A for loop takes a sequence and loops through each item in it.
🌐
Medium
medium.com › @khasnobis.sanjit890 › python-reverse-string-74cc521cf8ca
Python Reverse String. Today we are going to write some code… | by Sanjit Khasnobis | Medium
September 10, 2023 - def reverseStr_slicemethod(inputStr): outputStr = inputStr[::-1] return outputStr def reverseStr_loopinglist_appendmethod(inputStr): outputStrlist = [] inputStrlist = list(inputStr) len_of_list = len(inputStrlist) for i in range(len_of_list): outputStrlist.append(inputStrlist[(len_of_list-i)-1]) outputStr = "".join(outputStrlist) return outputStr def reverseStr_reversed_method(inputStr): inputStrlist = list(inputStr) outputStrlist = reversed(inputStrlist) outputStr = "".join(outputStrlist) return outputStr def reverseStr_strconcat_method(inputStr): outputStr = '' for i in inputStr: outputStr =