To get a new reversed list, apply the reversed function and collect the items into a list:
>>> xs = [0, 10, 20, 40]
>>> list(reversed(xs))
[40, 20, 10, 0]
To iterate backwards through a list:
>>> xs = [0, 10, 20, 40]
>>> for x in reversed(xs):
... print(x)
40
20
10
0
Answer from codaddict on Stack OverflowProgramiz
programiz.com โบ python-programming โบ methods โบ list โบ reverse
Python List reverse()
# List Reverse systems.reverse() # updated list print('Updated List:', systems)
W3Schools
w3schools.com โบ python โบ ref_list_reverse.asp
Python List reverse() Method
The built-in function reversed() returns a reversed iterator object. ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: sales@w3schools.com ยท If you want to report an error, or if you want to make a suggestion, send us an e-mail: help@w3schools.com ยท HTML Tutorial CSS Tutorial JavaScript Tutorial How To Tutorial SQL Tutorial Python Tutorial W3.CSS Tutorial Bootstrap Tutorial PHP Tutorial Java Tutorial C++ Tutorial jQuery Tutorial
python - How do I reverse a list or loop over it backwards? - Stack Overflow
Why use reversed() instead of slicing? Read the Zen of Python, rule number 7: Readability counts! 2017-04-25T08:26:15.837Z+00:00 ... Extended slice syntax is explained here. See also, documentation. ... It works for any interable, not just lists. Disadvantage is that it's not in place. 2010-10-15T07:04:10.803Z+00:00 ... @Swiss Not in every iterable, for example... More on stackoverflow.com
Beginner question: assigning variable to list.reverse()
Any idea why assigning variable Y to this does not result in anything ยท Yes. To avoid an accident where you think you have a new, separate, list there is a convention in Python that a function which changes something in place returns None so that you canโt proceed thinking you have a new thing. More on discuss.python.org
Why does [::-1] reverse a list?
[Start:stop:step] if you're going in steps by negative one, you're going backwards More on reddit.com
Reverse recursively a linked list
Not exactly what you are looking for, but this should give you the tools you need (if you haven't already seen it): https://rust-unofficial.github.io/too-many-lists/ More on reddit.com
Videos
05:50
Reverse a Linked List in groups of given size | Set 1 | GeeksforGeeks ...
03:52
Reverse first K elements of given linked list | GeeksforGeeks - ...
07:27
Reverse string in Python | GeeksforGeeks - YouTube
01:45
Reversing a linked list | GeeksforGeeks - YouTube
02:44
20 Ways You Can Reverse List in Python - YouTube
06:31
The One List Reversal Method That Separates Good Coders From Great ...
Codecademy
codecademy.com โบ article โบ how-to-reverse-a-list-in-python
How to Reverse a List in Python | Codecademy
Learn how to reverse a list in Python using `.reverse()`, `reversed()`, slicing, the two-pointer method, loops, and recursion with examples.
Real Python
realpython.com โบ python-reverse-list
Reverse Python Lists: Beyond .reverse() and reversed() โ Real Python
June 28, 2023 - The rest of the magic in this example comes from using a value of -1 for step. When you run this trick, you get a copy of the original list in reverse order without affecting the input data. If you fully rely on implicit indices, then the slicing syntax gets shorter, cleaner, and less error-prone: ... >>> digits = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> # Rely on default index values >>> digits[::-1] [9, 8, 7, 6, 5, 4, 3, 2, 1, 0] Here, you ask Python to give you the complete list ([::-1]) but going over all the items from back to front by setting step to -1.
Top answer 1 of 16
1734
To get a new reversed list, apply the reversed function and collect the items into a list:
>>> xs = [0, 10, 20, 40]
>>> list(reversed(xs))
[40, 20, 10, 0]
To iterate backwards through a list:
>>> xs = [0, 10, 20, 40]
>>> for x in reversed(xs):
... print(x)
40
20
10
0
2 of 16
1542
>>> xs = [0, 10, 20, 40]
>>> xs[::-1]
[40, 20, 10, 0]
Extended slice syntax is explained here. See also, documentation.
GeeksforGeeks
geeksforgeeks.org โบ python โบ python-reversing-list
Reversing a List in Python - GeeksforGeeks
For Example: Input: [10, 20, 30, 40, 50] Output: [50, 40, 30, 20, 10] Let's see other different methods to reverse a list. reverse() method reverses the elements of the list in-place and it modify the original list without creating a new list.
Published ย November 26, 2025
GeeksforGeeks
geeksforgeeks.org โบ python โบ python-list-reverse
Python List Reverse() - GeeksforGeeks
April 25, 2025 - In this example, we are reversing the list of mixed data types using reverse() method. ... Another common way to reverse a list in Python is using slicing ([::-1]).
Tutorialspoint
tutorialspoint.com โบ python โบ list_reverse.htm
Python List reverse() Method
The original list is then reversed ... or not. str = "malayalam" list1 = list(str) # Copy the list in another list using copy() method list2 = list1.copy() # Reverse the list using the reverse() method res = list1.reverse() if list1 == list2: print("The string is a palindrome") else: print("The string is not a palindrome")...
DataCamp
datacamp.com โบ tutorial โบ python-reverse-list
Python Reverse List: How to Reorder Your Data | DataCamp
February 27, 2025 - Since it creates a new list, it's helpful when you want to maintain the original list's order. #Python Example: Reversing a list with slicing numbers = [1, 2, 3, 4, 5] reversed_numbers = numbers[::-1] print(reversed_numbers) # Output: [5, 4, 3, 2, 1] print(numbers) # Original list remains [1, ...
Mimo
mimo.org โบ glossary โบ python โบ list-reverse-method
Python List reverse() Method: Syntax, Methods, and Examples
Learn how to reverse a list in Python using slicing, reverse(), reversed(), and loops. Compare methods, use cases, and performance best practices.
dbader.org
dbader.org โบ blog โบ python-reverse-list
How to Reverse a List in Python โ dbader.org
July 11, 2017 - You can leave them out and, for example, create a full (shallow) copy of a list like this: ... The step parameter, sometimes called the stride, is also interesting. Hereโs how you can create a copy of a list that only includes every other element of the original: ... We ask Python to give us the full list (::), but to go over all of the elements from back to front by setting the step to -1. Pretty neat, eh? Reversing a list using reverse iteration with the reversed() built-in is another option.
Scaler
scaler.com โบ home โบ topics โบ python list reverse()
Python List reverse() - Scaler Topics
May 7, 2024 - Learn how to reverse a list in Python using three different methods. In this article on scaler topics, every approach for reversing a list is explained with an example.
Upgrad
upgrad.com โบ home โบ tutorials โบ software & tech โบ how to reverse a list in python?
Reversing a List in Python
November 11, 2024 - If you want to work with a new list that contains the reversed elements, convert the iterator to a list using the list() function. ... # Example 1 - Using reverse() original_list = [1, 2, 3, 4, 5] original_list.reverse() print(original_list) ...
Python Guides
pythonguides.com โบ reverse-a-list-in-python
How to Reverse a List in Python
September 30, 2025 - Learn how to reverse a list in Python using slicing, loops, reverse() method, and more. Step-by-step guide with practical code examples for beginners and pros.