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 - Explore efficient methods to reverse a string in Python, including slicing, loops, and built-in functions, with clear examples and performance analysis.
🌐
DigitalOcean
digitalocean.com › community › tutorials › python-reverse-string
Python Reverse String - 5 Ways and the Best One | DigitalOcean
August 3, 2022 - 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.
🌐
Tutorial Gateway
tutorialgateway.org › python-program-to-reverse-string
Python Program to Reverse a String
January 4, 2026 - This article shows how to write a Python program to reverse a String using For Loop, while loop, Functions, recursion, list comprehension, etc.
🌐
STechies
stechies.com › 5-different-ways-reverse-string-python
Reverse String in Python Using 5 Different Methods
In this article you will learn 5 different ways to reverse the string in Python such as using for loop, Using while loop, Using slicing, Using join() and reversed() and using list reverse(). In python string library, there is no in-build “reversefunction to reverse a string, but there ...
🌐
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 - Python string library doesn't have the in-built reverse() function. But Using for loop or while loop you can reverse a string in Python.
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 - Trying to reverse a string in Python? There are several easy ways to do so! You can use the slice function to reverse the string in 1 line of code. Alternatively, use a For loop or the reversed() function for additional flexibility in the reversal process. You can also use the join() function ...
🌐
Python Examples
pythonexamples.org › python-reverse-string
Python - Reverse String
Python Program to Reverse String - In this tutorial, we shall learn how to reverse a string using 1. String Slicing 2. For Loop 3. While Loop and 4. List.reverse(). Examples for each of the processes is given.
🌐
Linode
linode.com › docs › guides › how-to-reverse-a-string-in-python
How to Reverse a String in Python | Linode Docs
May 13, 2022 - Wondering how to reverse a string in python? Follow our step-by-step instructions on the process, including information on the different methods available.
🌐
Real Python
realpython.com › reverse-string-python
Reverse Strings in Python: reversed(), Slicing, and More – Real Python
July 31, 2023 - So far, you’ve learned about core Python tools and techniques to reverse strings quickly. Most of the time, they’ll be your way to go. However, you might need to reverse a string by hand at some point in your coding adventure. In this section, you’ll learn how to reverse strings using explicit loops and recursion. The final technique uses a functional ...
🌐
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 using the range() function and len() function.
🌐
Python Guides
pythonguides.com › python-program-to-reverse-a-string
How To Reverse A String In Python?
January 12, 2026 - Master Python string reversal with my expert guide. Learn slicing, join methods, and recursion with real-world USA examples. Perfect for Python developers.
🌐
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 a string in Python using various methods: #Define a function def rev_func(string): # Declare a string variable revstr = '' #Iterate string with for loop for x in string: # Appending chars in reverse order revstr = x + revstr return revstr string = str(input()) ...
🌐
GUVI
guvi.in › blog › python › python reverse string: 7 effective ways with examples
Python Reverse String: 7 Effective Ways with Examples
January 8, 2026 - This article delves into effective methods for Python reverse string, providing you with a crucial skill that every coder should master for common problems.
🌐
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 - In this case, it is important to ensure the function is robust and handles all edge cases correctly. Overall, while reversing a string in Python may seem like a simple task, there are several challenges that developers need to consider. By understanding these challenges and choosing the appropriate approach, you can efficiently reverse the strings in your Python programs. Several ways to reverse an input string in Python include loops...
🌐
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 - However, Python does not come with a built-in function for reversing strings, but they are methods you can use. In this tutorial, you’ll learn different methods to reverse the string in Python. The first method for reversing strings is using a for loop as in the code snippet below:
🌐
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 - Python Reverse String Today we are going to write some code in python for solving a very basic problem which is possibly asked in many technical coding interviews Millions of times! I am back After …
🌐
Scaler
scaler.com › home › topics › string reverse in python
Reverse String in Python - Scaler Topics
April 8, 2022 - When we use strings in our python code, we can come across several conditions where we have to reverse the string, but we don't have any inbuilt function for reversing the string. In that case, we can use many approaches that can be useful in reversing the string, like using extended slice syntax, looping...