How do I reversed or iterate a list using its index?
Here is an example
lst = [3,2,4,1,5]
Output would be: [3,2,4,5,1] (index 3 which is 1 is place in the end)
Another example:
lst = [1,5,4,2,3]
Output: [1,5,4,3,2] (index 3 which is 2 is place in the end)
It is like the list is been reversed by using slicing.
If you want to reverse the part of a list past a certain point, the most straightforward way would be:
or, without the comments:
If you want to change the existing list, you can: