0
List slicing question...can anyone pls explain me the procedure?
squares = [0, 1, 4, 9, 16, 25, 36, 49, 64, 81] print(squares[9:5:-1]) Output [81, 64, 49, 36]
2 Answers
+ 3
This might help you a bit. :)
https://code.sololearn.com/cAQBZ3dHmbKW/?ref=app
+ 2
Get a slice of `list` <squares> from 9th item (value 81) down to (not including) 5th item (value 25).
The list items to slice will be read in reverse order due to the use of -1 value in stepping.