paint-brush
3 Efficient Ways to Reverse a List in Pythonby@itsmycode
255 reads

3 Efficient Ways to Reverse a List in Python

by Srinivas Ramakrishna2mOctober 15th, 2021
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

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. There are 3 ways to reverse lists in Python: using the reversed() built-in function, the reverse() function, and the list slicing technique. The only drawback of using this technique is that it will create a new copy of the reversed list, taking up additional memory. The reverse() method will not return anything as the list is reversed. However, we can copy the list before reversing if required.
featured image - 3 Efficient Ways to Reverse a List in Python
Srinivas Ramakrishna HackerNoon profile picture
Srinivas Ramakrishna

Srinivas Ramakrishna

@itsmycode

Solution Architect having 14+ Years of Experience in .NET Core, Python, Node.JS, JavaScript, Cloud (Azure), RDBMS

About @itsmycode
LEARN MORE ABOUT @ITSMYCODE'S
EXPERTISE AND PLACE ON THE INTERNET.
L O A D I N G
. . . comments & more!

About Author

Srinivas Ramakrishna HackerNoon profile picture
Srinivas Ramakrishna@itsmycode
Solution Architect having 14+ Years of Experience in .NET Core, Python, Node.JS, JavaScript, Cloud (Azure), RDBMS

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite
Also published here