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
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   March 3, 2026
Discussions

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
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
🌐
Flexiple
flexiple.com › python › python-reverse-string
Reverse String In Python - Flexiple
March 18, 2024 - The space complexity is also O(n), ... To reverse a string in Python using recursion, employ a function that recursively chops off the first character and appends it to the end....
🌐
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
🌐
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.
🌐
STechies
stechies.com › 5-different-ways-reverse-string-python
Reverse String in Python Using 5 Different Methods
In python string library, there is no in-build “reverse” function to reverse a string, but there are many different ways to reverse a string. In this article, you will learn 5 different ways to reverse the string in Python. ... # Program to explain reverse string or sentence # Using for loop # Reverse String without using reverse function # Define a function def reverse_for(string): # Declare a string variable rstring = '' # Iterate string with for loop for x in string: # Appending chars in reverse order rstring = x + rstring return rstring string = 'Stechies' # Print Original and Reverse string print('Original String: ', string) print('Reverse String: ', reverse_for(string))
🌐
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 ...
Find elsewhere
🌐
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 - Using a slice is the quickest, simplest way to reverse a string. Use a For loop if you need more customization in the reversal process. Try the reversed() function to create a reversed iterable object from the string.
🌐
Python Examples
pythonexamples.org › python-reverse-string
Python - Reverse String
# Given string x = "Hello World" # Reverse string using For loop x_reversed = '' for c in x: x_reversed = c + x_reversed # Print reversed string print(x_reversed) ... In this example, we use a Python While Loop statement, and during each iteration, we decrement the length.
🌐
Linode
linode.com › docs › guides › how-to-reverse-a-string-in-python
How to Reverse a String in Python | Linode Docs
May 13, 2022 - if reversal_style == "loop": string_out_list = [] for item in string_in: string_out_list.insert(0, item) string_out = "".join(string_out_list) # Use the reversed function if indicated by reversal_style. elif reversal_style == "reversed": reversed_iterator = reversed(string_in) string_out = "".join(list(reversed_iterator)) # Reverse the order of words, rather than characters, in # the string if indicated by reversal_style. elif reversal_style == "word": word_list = string_in.split(" ") word_list = word_list[::-1] string_out = " ".join(word_list) # By default, use the slice approach to reverse t
🌐
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.
🌐
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 - You can reverse a string in Python using a for loop with the following steps- Initialize an empty string to store the reversed version. Initiate a loop for iteration on string characters, i.e., characters of the initial string in reverse order ...
🌐
Python Guides
pythonguides.com › python-program-to-reverse-a-string
How To Reverse A String In Python?
January 12, 2026 - Using the reversed() function is a clear and flexible way to reverse a string without slicing, especially when you want to understand how iteration works in Python. If you prefer a more manual approach, you can use a loop to reverse a string.
🌐
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
🌐
Shiksha
shiksha.com › home › it & software › it & software articles › programming articles › how to reverse a string in python
How to Reverse a String in Python - Shiksha Online
March 3, 2023 - Let’s understand how to reverse ... order revstr = x + revstr return revstr string = str(input()) #Print Original and Reverse string print('Original String: ', string) print('Reverse String: ', rev_func(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 - In this code, s1 starts as an empty string. Each iteration of the loop prepends the current character to s1, effectively building the string in reverse order. Must Explore: 16 Famous Tech Companies That Use Python
🌐
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.
🌐
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.
🌐
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 =
🌐
Scaler
scaler.com › home › topics › string reverse in python
Reverse String in Python - Scaler Topics
April 8, 2022 - After iterating in reverse order, ... to reverse the string. We will recursively call the reverse() function and keep adding the last index character to the starting of the string....