Python provides several ways to access and manipulate the items of a list, tuple, or string. These include indexing, slicing, and the step argument.
Indices are zero-based, which means that the first element has an index of 0, the second element has an index of 1, and so on.
This Example Help you to understand the working of Python Index
ing
You can also use negative indices to access elements from the end of the sequence.
Slicing is a powerful method that allows us to extract a specific range of elements from a list or a string
We can use the colon (:) operator to slice a list or a string
['apple', 'banana', 'cherry'] ['cherry', 'mango', 'orange'] ['banana', 'cherry', 'mango']
The step argument is an optional parameter that allows us to skip elements while slicing.
It is denoted by using a third index separated by a colon
[5, 4, 3, 2, 1, 0]
Learn more