Reverse a List in Python Without Using reverse() Function Last Updated : 27 Nov, 2024 Summarize Comments Improve Suggest changes Share Like Article Like Report While reverse() is the easiest and most direct method to reverse a list in Python it's useful to know alternative approaches to reverse a list without relying on this function. Using SlicingWe can use Python’s list-slicing feature to create a reversed list version without modifying the original one. Python a = [1, 2, 3, 4, 5] # Reversing using slicing a_reversed = a[::-1] print(a_reversed) Output[5, 4, 3, 2, 1] a[::-1] creates a new list with the elements of a in reverse order. The -1 in the slice means we step through the list backwards.Let's look into the other alternatives methods: Using for LoopAnother way to reverse a list is by using a simple loop. We can iterate over the list and append the elements in reverse order to a new list. Python a = [1, 2, 3, 4, 5] # New list to hold reversed values b = [] # Loop through the original list in reverse for i in range(len(a) - 1, -1, -1): b.append(a[i]) print(b) Output[5, 4, 3, 2, 1] Using List ComprehensionList comprehension is a more compact way to reverse a list by iterating over the original list in reverse order and constructing a new list. Python a = [1, 2, 3, 4, 5] # Using list comprehension to reverse the list reversed_list = [a[i] for i in range(len(a) - 1, -1, -1)] print(reversed_list) Output[5, 4, 3, 2, 1] Comment More infoAdvertise with us Next Article Reverse a list without using built-in functions P pragya22r4 Follow Improve Article Tags : Python Python Programs Python list-programs Practice Tags : python Similar Reads Reverse a list without using built-in functions Reversing a list in Python is a common task, but sometimes we might not want to use built-in functions like reverse() or slicing. Letâs first look at a simple example where we reverse a list by swapping elements:Swapping Elements (In-Place)The most efficient way to reverse a list is by swapping elem 4 min read How To Reverse A List In Python Using Slicing In Python, list slicing is a common practice and it is the most used technique for programmers to solve efficient problems. In this article, we will see how we can reverse a list using slicing in Python. Reverse a List Using Slicing in PythonBelow are some of the examples by which we can perform rev 3 min read Reverse All Strings in String List in Python We are given a list of strings and our task is to reverse each string in the list while keeping the order of the list itself unchanged. For example, if we have a list like this: ['gfg', 'is', 'best'] then the output will be ['gfg', 'si', 'tseb'].Using For LoopWe can use a for loop to iterate over th 2 min read Python Program For Printing Reverse Of A Linked List Without Actually Reversing Given a linked list, print reverse of it using a recursive function. For example, if the given linked list is 1->2->3->4, then output should be 4->3->2->1.Note that the question is only about printing the reverse. To reverse the list itself see this Difficulty Level: Rookie Algorit 2 min read Python - Reverse Range in String List Given a string list, reverse each element of string list from ith to jth index. Input : test_list = ["Geeksforgeeks", "Best", "Geeks"], i, j = 1, 2 Output : ['ee', 'es', 'ee'] Explanation : Range of strings are extracted. Input : test_list = ["Geeksforgeeks"], i, j = 1, 7 Output : ['eeksfor'] Explan 3 min read Python | Reverse sign of each element in given list Given a list of integers, write a Python program to reverse the sign of each element in given list. Examples: Input : [-1, 2, 3, -4, 5, -6, -7] Output : [1, -2, -3, 4, -5, 6, 7] Input : [-5, 9, -23, -2, 7] Output : [5, -9, 23, 2, -7] Methods #1: List comprehension Python3 # Python3 program to Conver 3 min read Like