Answers for "what does [::-1] mean in python?"

2

what does [::-1] mean in python

list[<start>:<stop>:<step>]
So, when you do MyList[::-1], its starts from the end towards the begining taking each element by a step of 1 (hence -1). So, its reversing the list. Applicable to tuples as well
Posted by: Guest on December-10-2020

Code answers related to "what does [::-1] mean in python?"

Python Answers by Framework

Browse Popular Code Answers by Language