Understanding slice notation

It’s pretty simple really: There is also the step value, which can be used with any of the above: The key point to remember is that the :stop value represents the first value that is not in the selected slice. So, the difference between stop and start is the number of elements selected (if step is 1, the default). The other feature is that start or stop may be a negative number, which … Read more

Difference between del, remove, and pop on lists

The effects of the three different methods to remove an element from a list: remove removes the first matching value, not a specific index: del removes the item at a specific index: and pop removes the item at a specific index and returns it. Their error modes are different too: