๐ŸŒ
DigitalOcean
digitalocean.com โ€บ community โ€บ tutorials โ€บ python-reverse-string
Python Reverse String - 5 Ways and the Best One | DigitalOcean
August 3, 2022 - I understand the first one is to tell Python to look at all the elements in string, the second one Iโ€™m unsure about but [ -1] means that the first item to return needs to be at length [-1]. What does the second colon operator tell Python to do? Thanks ... Hi, Thank you for the explanation. I also wanted to know how to add new lines to the output. For example I have made a reverse string input program: def reverse_slice(s): return s[::-1] s=input('enter a string ') print(s[::-1]) How would I a make my answer be on multiple lines?
๐ŸŒ
Tutorialspoint
tutorialspoint.com โ€บ python โ€บ python_reversed_function.htm
Python reversed() Function
The Python reversed() function returns an iterator object which allows us to access the specified sequence in reverse order. This function is commonly used in the situation where we want to iterate over the elements of a sequence in reverse, without
Discussions

Method for reversing strings - Ideas - Discussions on Python.org
There may be other methods like splitting the string, reversing the resulting list, and then joining it back, but thatโ€™s a bit of work! There have been several times in my QA career where I am scripting in Python and need to reverse a string, but I have to look up the [::-1] syntax because ... More on discuss.python.org
๐ŸŒ discuss.python.org
1
February 20, 2025
In python, is it recommended to use [::-1] or reversed() to reverse a collection?

I wouldn't bother with performance. You are after all dealing with Python, probably one of the slowest popular language. Won't matter too much.

reversed() is clearer, but iirc [::-1] is more Pythonic.

More on reddit.com
๐ŸŒ r/AskProgramming
2
1
December 28, 2016
Reversing lists in Python
  • [...] is technically an operator, not a function.

  • Why do you exclude one-element lists? Single-digit numbers are palindromes. Arguably empty lists also read the same backwards and forwards. Does the assignment tell you to exclude them?

  • Why do you think that palindromes can't have an even number of characters? What about ABBA and 123321?

  • Why are you wrapping len in int? What type do you expect len to return?

More on reddit.com
๐ŸŒ r/learnpython
7
1
March 20, 2014
Is it just me, or is string reversing difficult/surprising?
The official Python community for Reddit! Stay up to date with the latest news, packages, and meta information relating to the Python programming language. --- If you have questions or are new to Python use r/LearnPython ... Yes, I realize that there are alternatives, but they are non-obvious (or at least not as obvious as str.reverse... More on reddit.com
๐ŸŒ r/Python
97
44
July 12, 2015
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ ref_func_reversed.asp
Python reversed() Function
Python Examples Python Compiler ... Q&A Python Bootcamp Python Certificate Python Training ... The reversed() function returns a reversed iterator object....
๐ŸŒ
Bhrighu
bhrighu.in โ€บ blog โ€บ reverse-a-string-in-python
How to Reverse a String in Python (5 Easy Methods)
However, this one-liner is unparalleled in its clarity and speed for reversing. Python offers the built-in reversed() function, which returns an iterator that accesses the given sequence in the reverse order.
๐ŸŒ
Python
docs.python.org โ€บ 3 โ€บ library โ€บ itertools.html
itertools โ€” Functions creating iterators for efficient looping
1 month ago - def combinations_with_replacement(iterable, r): # combinations_with_replacement('ABC', 2) โ†’ AA AB AC BB BC CC pool = tuple(iterable) n = len(pool) if not n and r: return indices = [0] * r yield tuple(pool[i] for i in indices) while True: for i in reversed(range(r)): if indices[i] != n - 1: break else: return indices[i:] = [indices[i] + 1] * (r - i) yield tuple(pool[i] for i in indices)
๐ŸŒ
Programiz
programiz.com โ€บ python-programming โ€บ methods โ€บ list โ€บ reverse
Python List reverse()
Become a certified Python programmer. Try Programiz PRO! ... The reverse() method reverses the elements of the list.
Find elsewhere
๐ŸŒ
freeCodeCamp
freecodecamp.org โ€บ news โ€บ python-reverse-list-reversing-an-array-in-python
Python Reverse List โ€“ Reversing an Array in Python
September 6, 2022 - The reversed() built-in function in Python returns a reversed iterator โ€“ an iterable object which is then used to retrieve and go through all the list elements in reverse order.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ reverse-string-python-5-different-ways
How to reverse a String in Python - GeeksforGeeks
We can reverse the string by taking a step value of -1. ... Python provides a built-in function called reversed() which can be used to reverse the characters in a string.
Published ย  3 weeks ago
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-reversed-function
Python reversed() Method - GeeksforGeeks
February 17, 2026 - reversed() function in Python returns an iterator that accesses elements in reverse order. It does not create a new reversed copy of the sequence, making it memory-efficient.
๐ŸŒ
Skillfountain
skillfountain.in โ€บ notes โ€บ reverse-function-in-python
`reversed()` Function in Python [ English ] | Skill Fountain
The reversed() function in Python is a built-in function used to return an iterator that accesses the elements of a sequence in reverse order.
๐ŸŒ
Real Python
realpython.com โ€บ ref โ€บ builtin-functions โ€บ reversed
reversed() | Pythonโ€™s Built-in Functions โ€“ Real Python
The built-in reversed() function takes a sequence as an argument and returns an iterator that yields the elements in reverse order.
๐ŸŒ
Medium
medium.com โ€บ @naqvishahwar120 โ€บ reverse-vs-reversed-in-python-9c210e3f125e
reverse() vs reversed() in Python - Shahwar Alam Naqvi - Medium
January 17, 2025 - reverse() vs reversed() in Python Python reverse() Mutating method : It modifies the original list Returns nothing, just changes the list. Works only on List. Example : mera_list = โ€ฆ
๐ŸŒ
w3resource
w3resource.com โ€บ python โ€บ built-in-function โ€บ reversed.php
Python reversed() function - w3resource
August 19, 2022 - Python reversed() function: The reversed() function is used to get a reverse iterator.
๐ŸŒ
Programiz
programiz.com โ€บ python-programming โ€บ methods โ€บ built-in โ€บ reversed
Python reversed()
Become a certified Python programmer. Try Programiz PRO! ... The reversed() function returns an iterator object that provides access to the elements of an iterable (list, tuple, string, etc.) in reverse order.
๐ŸŒ
Plain English
python.plainenglish.io โ€บ understanding-reverse-vs-reversed-in-python-4ce1750722d4
Understanding reverse vs reversed in Python | by Allwin Raju | Python in Plain English
November 19, 2024 - The reverse() method is specific to mutable sequences, such as lists. It modifies the sequence in place, which means the original data structure is updated and no new object is created.
๐ŸŒ
LabEx
labex.io โ€บ home โ€บ builtin โ€บ reversed
Python reversed() built-in function - Python Cheatsheet
The reversed() function returns a reverse iterator. This means it can be used to loop over a sequence (like a list, tuple, or string) in reverse order.
๐ŸŒ
Scaler
scaler.com โ€บ topics โ€บ reversed-in-python
Reversed in Python | Python reversed() Function - Scaler Topics
July 4, 2022 - The built-in reversed function in Python is used to reverse a sequence like a list, string, or tuple by creating a reverse iterator of the given sequence.
๐ŸŒ
AskPython
askpython.com โ€บ home โ€บ what is python reversed() function?
What is Python reversed() function? - AskPython
August 6, 2022 - The reversed() function returns a reverse iterator i.e. it returns an iterator that fetches and represents the data values in a reversed order. Now, let us understand the implementation of Python reversed() function in the below section.
๐ŸŒ
Python.org
discuss.python.org โ€บ ideas
Method for reversing strings - Ideas - Discussions on Python.org
February 20, 2025 - I would like to add a .reverse() method for strings. I think most modern languages have something like that and [::-1] is a bit archaic with little charm. There may be other methods like splitting the string, reversing tโ€ฆ