I am trying to create a function that reverses and mutates a list via slicing/appending without using [::-1]
or .reverse()
. I am looking for any additional resources online but it seems to be the only two popular reserving techniques.
Can anyone help me think of how I can write this?
Asked
Active
Viewed 54 times
-1

skaul05
- 2,154
- 3
- 16
- 26

skepticalforever
- 91
- 6
-
1Old fashion `for i in range(len(list)-1, 0, -1):`? – music_junkie Nov 14 '19 at 05:44
-
Use `for` loop to iterate over index backward and append the elements – Sociopath Nov 14 '19 at 05:46
-
I'm trying to think of how I would do this with a list of unspecified length – skepticalforever Nov 14 '19 at 05:46
-
apart from [::-1] and .reverse() there is another built in function called reversed() – Prathik Kini Nov 14 '19 at 05:48