range and len are both built-in functions. Since list methods are accepted, you could do this with insert. It is reeaallyy slow* but it does the job for small lists without using any built-ins:

def rev(l):
    r = []
    for i in l:
        r.insert(0, i)
    return r

By continuously inserting at the zero-th position you end up with a reversed version of the input list:

>>> print(rev([1, 2, 3, 4]))
[4, 3, 2, 1]

Doing:

def rev(l): 
    return l[::-1] 

could also be considered a solution. ::-1 (:: has a different result) isn't a function (it's a slice) and [] is, again, a list method. Also, contrasting insert, it is faster and way more readable; just make sure you're able to understand and explain it. A nice explanation of how it works can be found in this S.O answer.

*Reeaaalllyyyy slow, see juanpa.arrivillaga's answer for cool plot and append with pop and take a look at in-place reverse on lists as done in Yoav Glazner's answer.

Answer from Dimitris Fasarakis Hilliard on Stack Overflow
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ reverse-a-list-in-python-without-using-reverse-function
Reverse a List in Python Without Using reverse() Function - GeeksforGeeks
July 23, 2025 - We can use Pythonโ€™s list-slicing feature to create a reversed list version without modifying the original one.
๐ŸŒ
Reddit
reddit.com โ€บ r/learnpython โ€บ reversing a simple list without reverse function
r/learnpython on Reddit: Reversing a simple list without reverse function
October 12, 2014 -

I've tried to google this but a lot of the answers I got were using old python versions.

groceries = ["apples", "bread", "milk", "eggs"];
groceries.reverse ();
print (groceries)

Above is that obvious way to reverse the list but how would I go about doing that without the built in reverse function?

Could someone also explain to me how "the big-O" would have anything to do with this?

Edit: Essentially what I am trying to do is create a new function from scratch that takes my list and reverses it.

Edit 2:

Ok this is what I have so far, it doesn't work but maybe this will help you see what I am trying to do:

data_list = [1,2,"cat",4,"dog",6]

def backward(data_list):
    length = len(data_list)
    s = length

    new_list = [None]*length

    for item in data_list:
        s = s - 1
        new_list[s] = item
    return new_list

data_rev = data_list.backward

print(data_list)
print()
print(data_rev)
Discussions

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
๐ŸŒ r/Python
4
0
February 19, 2022
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
๐ŸŒ stackoverflow.com
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
๐ŸŒ r/learnpython
57
187
March 12, 2022
Reversing a list in Python?
I have no idea what the '::' means Please read about ranges in python. They are used all the time and you really need to understand them. There is reverse() and reversed() in python. One changes the list and the other doesn't change the list, but iterates through it from the back. More on reddit.com
๐ŸŒ r/learnprogramming
12
1
February 11, 2022
People also ask

When should I use NumPy to reverse a list instead of native Python methods?
NumPy is particularly useful for working with numerical data and multi-dimensional arrays. Use NumPy when you need to reverse NumPy arrays or when you require specialized array operations.
๐ŸŒ
upgrad.com
upgrad.com โ€บ home โ€บ tutorials โ€บ software & tech โ€บ how to reverse a list in python?
Reversing a List in Python
Are there any trade-offs between using built-in functions and manual methods to reverse a list?
Built-in functions like reverse() and reversed() are often more concise and easy to use, while manual methods provide more control and can be more educational for beginners.
๐ŸŒ
upgrad.com
upgrad.com โ€บ home โ€บ tutorials โ€บ software & tech โ€บ how to reverse a list in python?
Reversing a List in Python
How does slicing work when reversing a list?
Slicing with a step of -1 creates a new list with the elements in reverse order. It's a concise and efficient way to reverse a list.
๐ŸŒ
upgrad.com
upgrad.com โ€บ home โ€บ tutorials โ€บ software & tech โ€บ how to reverse a list in python?
Reversing a List in Python
Top answer
1 of 11
7

range and len are both built-in functions. Since list methods are accepted, you could do this with insert. It is reeaallyy slow* but it does the job for small lists without using any built-ins:

def rev(l):
    r = []
    for i in l:
        r.insert(0, i)
    return r

By continuously inserting at the zero-th position you end up with a reversed version of the input list:

>>> print(rev([1, 2, 3, 4]))
[4, 3, 2, 1]

Doing:

def rev(l): 
    return l[::-1] 

could also be considered a solution. ::-1 (:: has a different result) isn't a function (it's a slice) and [] is, again, a list method. Also, contrasting insert, it is faster and way more readable; just make sure you're able to understand and explain it. A nice explanation of how it works can be found in this S.O answer.

*Reeaaalllyyyy slow, see juanpa.arrivillaga's answer for cool plot and append with pop and take a look at in-place reverse on lists as done in Yoav Glazner's answer.

2 of 11
1

:: is not a function, it's a python literal. as well as []

How to check if ::, [] are functions or not. Simple,

    import dis
    a = [1,2]
    dis.dis(compile('a[::-1]', '', 'eval'))
      1           0 LOAD_NAME                0 (a)
                  3 LOAD_CONST               0 (None)
                  6 LOAD_CONST               0 (None)
                  9 LOAD_CONST               2 (-1)
                 12 BUILD_SLICE              3
                 15 BINARY_SUBSCR
                 16 RETURN_VALUE

If ::,[] were functions, you should find a label CALL_FUNCTION among python instructions executed by a[::-1] statement. So, they aren't.

Look how python instructions looks like when you call a function, lets say list() function

>>> dis.dis(compile('list()', '', 'eval'))
  1           0 LOAD_NAME                0 (list)
              3 CALL_FUNCTION            0
              6 RETURN_VALUE

So, basically

def rev(f):
    return f[::-1]

works fine. But, I think you should do something like Jim suggested in his answer if your question is a homework or sent by you teacher. But, you can add this quickest way as a side note.

If you teacher complains about [::-1] notation, show him the example I gave you.

๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-reversing-list
Reversing a List in Python - GeeksforGeeks
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. ... This method builds a reversed version of the list using slicing with a negative step. ... Python's built-in reversed() function is another way to reverse the list.
Published ย  November 26, 2025
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ reverse-a-list-without-using-built-in-functions
Reverse a list without using built-in functions - GeeksforGeeks
July 23, 2025 - Let's take a look at different approaches to reverse a list without using built-in functions. ... Another simple method is to use Python's negative indexing to access elements from the end of the list.
๐ŸŒ
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
Answer (1 of 3): 1) Initialize start and end indexes as start = 0, end = n-1 2) In a loop, swap arr[start] with arr[end] and change start and end as follows : start = start +1, end = end โ€“ 1 [code ]def[/code] [code ]reverseList(A, start, end):[/code] [code ] while[/code] [code ]start
Find elsewhere
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ ref_list_reverse.asp
Python List reverse() Method
Python Examples Python Compiler Python Exercises Python Quiz Python Challenges Python Server Python Syllabus Python Study Plan Python Interview Q&A Python Bootcamp Python Certificate Python Training ... The reverse() method reverses the sorting order of the elements. ... 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
๐ŸŒ
Upgrad
upgrad.com โ€บ home โ€บ tutorials โ€บ software & tech โ€บ how to reverse a list in python?
Reversing a List in Python
November 11, 2024 - Reversing a list involves changing the order of its elements from the last to the first. Here are the general how to reverse a list in Python without reverse function steps involved:
๐ŸŒ
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 ...
๐ŸŒ
Reddit
reddit.com โ€บ r/python โ€บ how to reverse a python list (3 methods)
r/Python on Reddit: How to reverse a Python list (3 methods)
February 19, 2022 -

There are three methods you can use to reverse a list:

  1. An in-place reverse, using the built-in reverse method that every list has natively

  2. Using list slicing with a negative step size, resulting in a new list

  3. Create a reverse iterator, with the reversed() function

You can try this for yourself too. Click here to open a runnable/editable example.

๐ŸŒ
Real Python
realpython.com โ€บ python-reverse-list
Reverse Python Lists: Beyond .reverse() and reversed() โ€“ Real Python
June 28, 2023 - In this step-by-step tutorial, you'll learn about Python's tools and techniques to work with lists in reverse order. You'll also learn how to reverse your list by hand.
๐ŸŒ
Unstop
unstop.com โ€บ home โ€บ blog โ€บ reversing python list | 10 ways explained with code examples
Reversing Python List | 10 Ways Explained With Code Examples
February 3, 2025 - Simplicity: It's one of the easiest methods to use when you want to reverse a list quickly and without any frills. However, if you need to keep the original list intact and return a reversed version, you may want to use other methods, like slicing or the reversed() function, which donโ€™t alter the original list. The slice operator in Python is a powerful tool, allowing you to access subparts of a list (or any iterable) in a variety of ways.
๐ŸŒ
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 - The above code will step over the elements from the original list in reverse order. ... Python has a function called slice() that returns a slice object which is used to specify how to slice a sequence. It takes 3 arguments (start, stop, step).
๐ŸŒ
Programiz
programiz.com โ€บ python-programming โ€บ methods โ€บ list โ€บ reverse
Python List reverse()
In this tutorial, we will learn about the Python List reverse() method with the help of examples.
๐ŸŒ
Reddit
reddit.com โ€บ r/learnprogramming โ€บ reversing a list in python?
r/learnprogramming on Reddit: Reversing a list in Python?
February 11, 2022 -

Hey, I'm learning lists in Python. When I try to use the reverse method to reverse my list it returns 'None'. I've read online that apparently this is because it doesn't actually change the list but I'm not sure what that means tbh. Even if it was a temporary modification, wouldn't it print that temporarily modified version of the list instead of printing 'None'? I found another solution (assuming the list is stored in my_list variable), print(my_list[::-1]). I understand that the -1 is referring to the end of the list (and maybe telling it to count back from there), but I have no idea what the '::' means. Would appreciate some help, thanks.

๐ŸŒ
Python.org
discuss.python.org โ€บ python help
Beginner question: assigning variable to list.reverse() - Python Help - Discussions on Python.org
May 12, 2022 - Any idea why assigning variable Y to this does not result in anything? create a list of prime numbers x = [2, 3, 5, 7] reverse the order of list elements y=x.reverse() print(y)
๐ŸŒ
Reddit
reddit.com โ€บ r/learnpython โ€บ reversing a list using slice
r/learnpython on Reddit: Reversing a list using slice
December 23, 2023 -
list[::-1]

I learned this years ago but never thought about it until reviewing just now. Why is it

[::-1]

? Does the first colon(:) mean we start at the beginning, and the second colon(:) mean we end also at the beginning?

Top answer
1 of 3
243
newlist = oldlist[::-1]

The [::-1] slicing (which my wife Anna likes to call "the Martian smiley";-) means: slice the whole sequence, with a step of -1, i.e., in reverse. It works for all sequences.

Note that this (and the alternatives you mentioned) is equivalent to a "shallow copy", i.e.: if the items are mutable and you call mutators on them, the mutations in the items held in the original list are also in the items in the reversed list, and vice versa. If you need to avoid that, a copy.deepcopy (while always a potentially costly operation), followed in this case by a .reverse, is the only good option.

2 of 3
68

Now let's timeit. Hint: Alex's [::-1] is fastest :)

$ p -m timeit "ol = [1, 2, 3]; nl = list(reversed(ol))"
100000 loops, best of 3: 2.34 usec per loop

$ p -m timeit "ol = [1, 2, 3]; nl = list(ol); nl.reverse();"
1000000 loops, best of 3: 0.686 usec per loop

$ p -m timeit "ol = [1, 2, 3]; nl = ol[::-1];"
1000000 loops, best of 3: 0.569 usec per loop

$ p -m timeit "ol = [1, 2, 3]; nl = [i for i in reversed(ol)];"
1000000 loops, best of 3: 1.48 usec per loop


$ p -m timeit "ol = [1, 2, 3]*1000; nl = list(reversed(ol))"
10000 loops, best of 3: 44.7 usec per loop

$ p -m timeit "ol = [1, 2, 3]*1000; nl = list(ol); nl.reverse();"
10000 loops, best of 3: 27.2 usec per loop

$ p -m timeit "ol = [1, 2, 3]*1000; nl = ol[::-1];"
10000 loops, best of 3: 24.3 usec per loop

$ p -m timeit "ol = [1, 2, 3]*1000; nl = [i for i in reversed(ol)];"
10000 loops, best of 3: 155 usec per loop

Update: Added list comp method suggested by inspectorG4dget. I'll let the results speak for themselves.