In Python, slicing is a technique used to extract a portion of a sequence, such as a string, list, or tuple.
The slice notation is expressed using square brackets [].The general syntax for slicing is sequence[start:stop:step], where start is the index of the first item to be included in the slice, stop is the index of the first item to be excluded from the slice, and step is the optional increment between items in the slice.
text = "Hello, World!"substring = text[0:5] # extracts "Hello"