Slice
Whether at work or in the process of interviewing, there are always a few things about slicing a collection and getting the part we want. Although this part is simple but important, the correct application can make you solve some complex problems more effectively. Let's take a formal study on slicing:
The prototype of the slice operator in Python is: [Start:stop:step]------- [start index: End index: Step value]
Start index : Same as other languages, starting from 0. Sequence from left to right, index of first value is 0, last one is-1
End Index : The slice operator is taken to the index and does not contain the value of the index
Step value : The default is one after the other, if it is 2, it means to take one operation. When the step value is positive, it is taken from left to right and, if negative, from right to left . The step value cannot be 0
Python Slicing knowledge Daquan