3 Ways to Reverse a List/String/Array in Python

Опубликовано: 23 Март 2026
на канале: Kunal Attri
31
1

How to reverse an array or list or string or tuple in Python?
There are various method for that: All of these work on all ordered sequences in python.
1. Using built-in reverse method: list.reverse(), string.reverse(), ...
This reverses the given ordered sequence itself. It doesnt return a new reversed sequence.
2. Using list slicing: list[::-1]. What this does is that, it takes the whole list in steps of -1, i.e. in reverse order.
3. Using a user defined function: One can also make a function manually to reverse the given sequence. One of those is shown in video which takes an ordered sequence as parameter, then it defines a variable to store reversed array. Then, we go through a for loop to iterate on all element of given sequence in reverse order, and we keep adding them to our array variable. Once it is done, we return the reversed array to the user.


This Program Code:-
Github: https://github.com/Kunal-Attri/Python...
Drive: https://drive.google.com/file/d/1dTOc...

All Python Codes:-
Github: https://github.com/Kunal-Attri/Python...
Drive: https://drive.google.com/drive/folder...

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Subscribe to us for more videos!!!

Music: Ikson - Blue Sky

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Python:    • Python  

Pokemon FireRed:    • Pokemon FireRed  

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If you own any rights to the content we use in our videos and want us to provide credits or remove the content , kindly contact us at [email protected] . We will solve it out with a hypothetic cup of tea(●'◡'●) .

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Instagram :-   / kunal.attri_  
Github:- https://github.com/kunal-attri

Like And Subscribe our Channel.......