Your function will not work since it's not returning the list.

Here is one way to solve this problem - using the for-loop:

def reverse_list(arr):
    result = []
    
    for i, _ in enumerate(arr):    # try to use enumerate - it's better in most cases
        result.append(arr[~i])     # use the backward indexing here
        
    return result
Answer from Daniel Hao on Stack Overflow
๐ŸŒ
Codecademy
codecademy.com โ€บ article โ€บ how-to-reverse-a-list-in-python
How to Reverse a List in Python | Codecademy
To enhance your understanding of Python concepts and dive into more advanced topics, check out the Learn Intermediate Python 3 course from Codecademy. Yes! You can use slicing ([::-1]), reversed(), a for loop, or recursion to reverse a list ...
Discussions

loops - Traverse a list in reverse order in Python - Stack Overflow
The [::-1] slice reverses the list in the for loop (but won't actually modify your list "permanently"). ... [::-1] creates a shallow copy, therefore it doesn't change the array neither "permanently" nor "temporary". 2009-02-09T19:15:23.307Z+00:00 ... This is slightly slower than using reversed, at least under Python ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
python - How do I reverse a list or loop over it backwards? - Stack Overflow
This slicing method is not very readable. The Pythonic way would be to use the reverse() method. ;-) 2018-05-31T12:21:28.863Z+00:00 ... Save this answer. ... Show activity on this post. Copyarray=[0,10,20,40] for e in reversed(array): print e More on stackoverflow.com
๐ŸŒ stackoverflow.com
How can I loop through an array forward and then backwards and then forwards and... etc with the modulus operator?
Given `n` is 1 less than the length of your array, you can increment and modulus some rotating index `i` against double `n` and then subtract `n`, take the absolute value and you get a bouncing number. It should be noted that you don't need to use any flags as suggested in other comments, but you do lose readability. Explanation: Take your example for an array of length 5, then `n=4`, `i` will rotate through values `[0, 1, 2, 3, 4, 5, 6, 7]` and subtracting `n` from each we get `[-4, -3, -2, -1, 0, 1, 2, 3]`, and the absolute values become `[4, 3, 2, 1, 0, 1, 2, 3]` which you can use to access the values at an index in your array. Try the following code: arr = [1, 2, 3, 4, 5] n = len(arr) - 1 i = n while True: curr_index = abs(i - n) print(arr[curr_index]) i = (i + 1) % (2 * n) and you will get output that looks like: 1 2 3 4 5 4 3 2 1 2 3 4 ... More on reddit.com
๐ŸŒ r/learnpython
5
1
September 9, 2021
Reversing a range using a FOR LOOP
You should show what you've tried so far. It's easier to give productive help if we base the help on code you've written. It doesn't require a for-loop though. You can use one, but it would be far more straightforward with a while. Be careful of artificially limiting what tools you consider. More on reddit.com
๐ŸŒ r/learnpython
11
0
December 24, 2022
๐ŸŒ
Tutorialspoint
tutorialspoint.com โ€บ python โ€บ python_reverse_arrays.htm
Python - Reverse Arrays
To reverse an array using a for loop, we first traverse the elements of the original array in reverse order and then append each element to a new array. The following example shows how to reverse an array in Python using for loop.
๐ŸŒ
PREP INSTA
prepinsta.com โ€บ home โ€บ python program โ€บ python code for reverse an array
Reverse the array using python | PrepInsta
October 7, 2022 - #reversing the array def rev(arr): for i in range(len(arr)//2): arr[i],arr[-i-1]=arr[-i-1],arr[i] return arr print(rev([2,3,4,5,5,6,0]))
๐ŸŒ
Medium
harsha2001.medium.com โ€บ five-different-ways-to-reverse-an-array-in-python-db7e6ac7a927
Five different ways to reverse an array in python | by harsha vardhan gupta | Medium
July 15, 2021 - By replacing the last element in the list with the first element and replacing the second element with the last second element until we reach the middle, the logic goes very simple, if we write code in python ...
๐ŸŒ
MakeUseOf
makeuseof.com โ€บ home โ€บ programming โ€บ how to use python to reverse a list or array
How to Use Python to Reverse a List or Array
March 31, 2022 - When using an indented for loop, the common approach is to iterate through the original list in reverse order. Starting with the final element, each iteration then appends the previous element to a new list.
Find elsewhere
๐ŸŒ
FavTutor
favtutor.com โ€บ blogs โ€บ reverse-array-python
5 Methods to Reverse Array in Python (reverse, recursion etc)
September 23, 2022 - Reversing an Array in Python is to reverse the contents of an array, be it changing the original array or creating a reversed copy of it. Whereas performing reverse iteration over an array simply implies iterating over the loop from the end of the array. Check out the code below for a better understanding:
๐ŸŒ
PrepBytes
prepbytes.com โ€บ home โ€บ python โ€บ reverse an array in python
Reverse an Array in Python
July 8, 2024 - Preparing data for certain types of analysis or visualization. 4. What are the common methods to reverse an array in Python? The common methods to reverse an array in Python include: Using slicing ([::-1]). The reverse() method of lists. The reversed() function. Manual in-place reversal using loops. Recursive methods. 5. What is the slicing method, and how does it reverse an array? The slicing method uses the [::-1] notation to create a new list that is a reversed copy of the original list.
๐ŸŒ
w3resource
w3resource.com โ€บ python-exercises โ€บ numpy โ€บ numpy-reverse-elements-of-large-array-using-for-loop-and-optimization.php
Numpy - Reverse elements of large array using For loop and Optimization
September 1, 2025 - Generating a large array: A large 1D NumPy array with random integers is generated. Defining the function: A function reverse_with_loop is defined to reverse the array using a for loop.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-reversing-list
Reversing a List in Python - GeeksforGeeks
However, reversed() returns an iterator, so it needs to be converted back into a list. ... If we want to reverse a list manually, we can use a loop (for loop) to build a new reversed list.
Published ย  May 29, 2026
๐ŸŒ
Quora
quora.com โ€บ How-do-you-reverse-an-array-in-Python-without-a-function
How to reverse an array in Python without a function - Quora
Quora is a place to gain and share knowledge. It's a platform to ask questions and connect with people who contribute unique insights and quality answers.
๐ŸŒ
freeCodeCamp
freecodecamp.org โ€บ news โ€บ python-reverse-list-reversing-an-array-in-python
Python Reverse List โ€“ Reversing an Array in Python
September 6, 2022 - You use the reversed() function with a for loop to iterate through the list items in reversed order. (If you need a refresher on for loops in Python, have a read through this article)
๐ŸŒ
Real Python
realpython.com โ€บ python-reverse-list
Reverse Python Lists: Beyond .reverse() and reversed() โ€“ Real Python
June 28, 2023 - For example, to reverse the list represented in the diagram, you can loop over the first half of the list and swap the element at index 0 with its mirror at index -1 in the first iteration.
๐ŸŒ
AskPython
askpython.com โ€บ python โ€บ array โ€บ reverse-an-array-in-python
Reverse an Array in Python โ€“ 10 Examples - AskPython
April 14, 2026 - TLDR: Use list slicing [::-1] for a quick reversed copy of a Python list. Use arr.reverse() for in-place reversal of a list. For NumPy arrays, prefer np.flip() or arr[::-1] โ€” both are fast and return new arrays.