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

python - Reverse a list without using built-in functions - Stack Overflow
I'm using Python 3.5. As part of a problem, I'm trying to design a function that takes a list as input and reverts it. So if x = [a, b, c] the function would make x = [c, b, a]. The problem is, ... More on stackoverflow.com
🌐 stackoverflow.com
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
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
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
🌐
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
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
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.
Published   November 26, 2025
🌐
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 ...
Find elsewhere
🌐
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.

🌐
Real Python
realpython.com › python-reverse-list
Reverse Python Lists: Beyond .reverse() and reversed() – Real Python
June 28, 2023 - 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 ...
🌐
DataCamp
datacamp.com › tutorial › python-reverse-list
Python Reverse List: How to Reorder Your Data | DataCamp
February 27, 2025 - In summary, use reverse() for in-place modifications when you don’t need the original list in its initial order. Use slicing ([::-1]) when you want a reversed list copy without altering the original. Beyond basic methods, Python offers more advanced techniques for reversing lists that provide ...
🌐
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.
🌐
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:
🌐
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 · 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.
🌐
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 - Note: If you try to reverse any data type other than lists, an AttributeError will be raised stating that ‘x’ has no attribute ‘reverse’. Python reversed() function is also used to reverse the elements inside 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
🌐
HackerNoon
hackernoon.com › 3-efficient-ways-to-reverse-a-list-in-python
3 Efficient Ways to Reverse a List in Python | HackerNoon
October 15, 2021 - Reversing a list is a common requirement in any programming language. In this tutorial, we will learn the effective way to reverse a list in Python.
🌐
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.