There are several ways to reverse a list in Python:
Using the reverse() method (in-place modification):
This method modifies the original list directly, reversing its elements without creating a new list.
Python
my_list = [1, 2, 3, 4, 5]
my_list.reverse()
print(my_list) # Output: [5, 4, 3, 2, 1]
Using slicing [::-1] (creates a new list):
This method creates a new reversed copy of the list while leaving the original list unchanged.
Python
original_list = [1, 2, 3, 4, 5]
reversed_list = original_list[::-1]
print(reversed_list) # Output: [5, 4, 3, 2, 1]
print(original_list) # Output: [1, 2, 3, 4, 5] (original list remains unchanged)
Using the reversed() function (returns an iterator):
The reversed() function returns an iterator that yields elements in reverse order. To get a list, you need to convert it using list().
Python
my_list = [1, 2, 3, 4, 5]
reversed_iterator = reversed(my_list)
reversed_list = list(reversed_iterator)
print(reversed_list) # Output: [5, 4, 3, 2, 1]
On this page of the site you can watch the video online REVERSE A LIST IN PYTHON(heck description) with a duration of hours minute second in good quality, which was uploaded by the user Oculustechnologies 18 July 2025, share the link with friends and acquaintances, this video has already been watched 2,088 times on youtube and it was liked by 9 viewers. Enjoy your viewing!