5 Ways to Reverse a String in Python — and Which One Should You Actually Use?

Reversing a string is a simple Python challenge:
“hello” → “olleh”
But there are several ways to do it, and each method teaches something different.
For each approach, we’ll answer two questions:
- What do you learn from it?
- Would you use it in real Python code?
Method 1: Using slicing
word = "hello"
reversed_word = word[::-1]
print(reversed_word)
Output:
olleh
Python slicing uses this format:
[start: stop: step]
In: [::-1], from start to end with the step being -1, so Python reads the string backward.
What do you learn?
You learn how slicing works and how a negative step can move through a sequence in reverse.
Would you use it in real code?
Yes. This is usually the simplest way to reverse a string.
Short summary: Best for real code.
Method 2: Adding each character to the front
word = "hello"
result = ""
for char in word:
result = char + result
print(result)
Output:
olleh
Each character is added to the beginning of result step by step:
h
eh
leh
lleh
olleh
But, why not use this?
result += char
Because that adds characters to the end:
h
he
hel
hell
hello
What do you learn?
You learn how loops build strings and how the order of concatenation matters.
Would you use it in real code?
Usually not. But it is useful for learning.
Short summary: Best for understanding loops and string construction.
Method 3: Looping backward with indexes
Instead of rearranging the characters, you can read the string from the end.
word = "hello"
result = ""
for i in range(len(word) - 1, -1, -1):
result += word[i]
print(result)
Output:
olleh
The indexes are visited like this:
4, 3, 2, 1, 0
So Python reads:
o l l e h
What do you learn?
You practice:
range()
len()
indexes
backward iteration
Would you use it in real code?
Not usually for reversing a string, but it is very useful for learning indexing.
Short summary: Best for learning indexes and backward loops.
Method 4: Using reversed()
Python also has a built-in function called reversed().
word = "hello"
reversed_word = "".join(reversed(word))
print(reversed_word)
Output:
olleh
reversed(text) gives the characters in reverse order:
o, l, l, e, h
Then:
"".join(…)
joins those characters together into one string.
What do you learn?
You learn how reversed() works and how join() combines characters into a string.
Would you use it in real code?
Yes. It is a good alternative to slicing, although it is a little longer.
Short summary: A clear built-in alternative to slicing.
Method 5: Using recursion
Recursion is when a function calls itself to solve a smaller version of the same problem.
def reverse_string(word):
if word == "":
return ""
return reverse_string(word[1:]) + word[0]
print(reverse_string("hello"))
The function keeps removing the first character:
reverse_string("hello")
reverse_string("ello") + "h"
reverse_string("llo") + "e" + "h"
reverse_string("lo") + "l" + "e" + "h"
reverse_string("o") + "l" + "l" + "e" + "h"
Eventually, the calls return:
olleh
What do you learn?
You learn the basic idea of recursion: a function solves a problem by calling itself with a smaller input.
Would you use it in real code?
Probably not for reversing a string, because it is more complicated than necessary. However, it is a useful way to learn how recursion works.
Short summary: Best for learning recursion, not for reversing strings in real projects.
The Bigger Lesson
The goal is not to memorise five ways to reverse "hello".
The important lesson is that one programming problem can have several correct solutions.
As you improve, the question changes from:
“Can I make this work?”
to
“Which solution is the clearest and most appropriate?”
Try It Yourself
Try reversing these strings without using [::-1]:
“python”
“Uni-beacon”
© 2026 Uni-Beacon. All rights reserved.