#use list slicing
a = [123,122,56,754,56]
print(a[::-1])
Answer from vijayrealdeal on Stack OverflowCodecademy
codecademy.com โบ article โบ how-to-reverse-a-list-in-python
How to Reverse a List in Python | Codecademy
In the first approach, reversed() is used with list() to create a new reversed list. In the second approach, reversed() is used directly in a for loop to iterate through elements in reverse order without creating a new list.
GeeksforGeeks
geeksforgeeks.org โบ python โบ python-reversing-list
Reversing a List in Python - GeeksforGeeks
This method is less efficient due to repeated insertions and extra space required to store the reversed list. ... a = [1, 2, 3, 4, 5] i, j = 0, len(a) - 1 while i < j: a[i], a[j] = a[j], a[i] i += 1 j -= 1 print(a) ... Loop continues until both ...
Published ย May 29, 2026
python - How do I reverse a list or loop over it backwards? - Stack Overflow
How do I iterate over a list in reverse in Python? See also: How can I get a reversed copy of a list (avoid a separate statement when chaining a method after .reverse)? More on stackoverflow.com
loops - Traverse a list in reverse order in Python - Stack Overflow
How do I traverse a list in reverse order in Python? So I can start from collection[len(collection)-1] and end in collection[0]. I also want to be able to access the loop index. More on stackoverflow.com
Python: why can't I do reversedList = thisList.reverse() in one line? It outputs None and I'm not sure why.
Functions take inputs and return values. For example, len(something) takes as input something and returns a number. Because it returns a number, x = len(something) will set x to whatever len() returned. The reverse() function returns None. That's it, just None. Calling it changes the list that you call it on, but the function itself doesn't return anything. The reason it returns None is that you, as the caller, need to be made aware that you are not creating a new list: you're changing the original list. originalList.reverse() CHANGES the original list into the reversed list, so assigning the result of that change somewhere suggests that the programmer doesn't know this and is probably about to make a mistake. On the other hand, there's a different, built-in function with a very similar name: reversed(). That function takes as input a list and returns a new list that is reversed. You can use it like this: reversedList = reversed(thisList). This will not change thisList. There's a related important concept here around what's called "side effects." Some functions change the state of the other things, and some functions simply calculate a value from inputs without changing anything. Functions that change things are said to have "side effects," and functions that do nothing besides returning a value, and always return the same value for the same input, are called "pure" functions. reversed() is a pure function, and someList.reverse() has side effects. More on reddit.com
How to reverse a Python list (3 methods)
Well don't forget about doing it by hand! print(list(lst[i] for i in range(-1, -len(lst)-1, -1))) More on reddit.com
Videos
01:07
How to use slicing to reverse a list in Python
02:44
20 Ways You Can Reverse List in Python - YouTube
05:32
Frequently Asked Python Program 13: How To Reverse a List - YouTube
03:00
02.1 Reverse looping array in python - Python List Exercises Tutorial ...
11:29
Python for Beginners: 13. How to reverse a string in Python using ...
00:32
Reverse List using for loop in python | python list - YouTube
Top answer 1 of 7
2
#use list slicing
a = [123,122,56,754,56]
print(a[::-1])
2 of 7
1
List can be reversed using for loop as follows:
>>> def reverse_list(nums):
... # Traverse [n-1, -1) , in the opposite direction.
... for i in range(len(nums)-1, -1, -1):
... yield nums[i]
...
>>>
>>> print list(reverse_list([1,2,3,4,5,6,7]))
[7, 6, 5, 4, 3, 2, 1]
>>>
Checkout this link on Python List Reversal for more details
Mimo
mimo.org โบ glossary โบ python โบ list-reverse-method
Python List reverse() Method: Syntax, Methods, and Examples
This built-in tool is part of how Python efficiently walks through a list backward. The underlying name comes from the behavior of a built-in reversed mechanism, which is powered by a built-in function. When dealing with large lists and lazy evaluation. Suitable for for-loops and iterators.
datagy
datagy.io โบ home โบ python posts โบ how to reverse a python list (6 ways)
How to Reverse a Python List (6 Ways) โข datagy
February 15, 2023 - We will iterate over each item in our original list in the negative order. Letโs take a look at what this looks like: # Reverse a Python list with a List Comprehension original_list = [1,2,3,4,5,6,7,8,9] start = len(original_list) - 1 reversed_list = [original_list[i] for i in range(start, -1, -1)] print(reversed_list) ...
Medium
geekpython.medium.com โบ 8-ways-to-reverse-the-elements-in-a-python-list-ad50889bdd7e
8 Ways To Reverse The Elements In A Python List | by Sachin Pal | Medium
November 25, 2022 - Python reversed() function is also used to reverse the elements inside the list. Still, instead of returning the reversed object, it returns the reversed iterator object that accesses the values of a given sequence. To access the values, you have to iterate them either by using the for loop or the next() function...
Top answer 1 of 16
1736
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.
TutorialKart
tutorialkart.com โบ python โบ python-reverse-list-using-for-loop
How to Reverse a List using For Loop in Python?
April 6, 2023 - #initialize list myList = ['apple', 'banana', 'cherry', 'mango'] #store reversed list in this reversedList = [] #reverse list using for loop for i in range(len(myList)) : reversedList.append(myList[len(myList) - i - 1]) #print lists print(f'Original List : {myList}') print(f'Reversed List : {reversedList}') ... Original List : ['apple', 'banana', 'cherry', 'mango'] Reversed List : ['mango', 'cherry', 'banana', 'apple'] ... In this Python Tutorial, we learned how to reverse a list using for loop.
Python Guides
pythonguides.com โบ reverse-a-list-in-python
How to Reverse a List in Python
September 30, 2025 - Use reversed() when you need an iterator or want to keep the original intact. Use loops when youโre learning Python or need more control.
GeeksforGeeks
geeksforgeeks.org โบ python โบ backward-iteration-in-python
Backward iteration in Python - GeeksforGeeks
July 11, 2025 - We can use slicing slicing notation [::-1] to reverse the order of elements in an iterable. This works for lists, tuples, and strings, but not for sets or dictionaries (since they are unordered).
Top answer 1 of 16
1825
Use the built-in reversed() function:
>>> a = ["foo", "bar", "baz"]
>>> for i in reversed(a):
... print(i)
...
baz
bar
foo
To also access the original index, use enumerate() on your list before passing it to reversed():
>>> for i, e in reversed(list(enumerate(a))):
... print(i, e)
...
2 baz
1 bar
0 foo
Since enumerate() returns a generator and generators can't be reversed, you need to convert it to a list first.
2 of 16
268
You can do:
for item in my_list[::-1]:
print item
(Or whatever you want to do in the for loop.)
The [::-1] slice reverses the list in the for loop (but won't actually modify your list "permanently").
Cherry Servers
cherryservers.com โบ home โบ blog โบ python โบ how to reverse a list in python (using 3 simple ways)
How to Reverse a List in Python (Using 3 Simple Ways) | Cherry Servers
November 7, 2025 - Slicing with [::-1] is suitable for small to moderate-sized lists where readability is important, despite its higher memory usage. Opt for loop-based reversal if you need to perform custom operations during the reversal process. It may be rather challenging to reverse a list in Python because of the following issues.