stringslike all sequence typessupport indexing and slicing we can retrieve any character from string by using its index [iwe can retrieve slice of string by using [ : ]where and are the start and end points of the slice we can return an extended slice by using strideas in the followings[ : :stridethe following code should make this clearthe first two examples are pretty straightforwardreturning the character located at index and the first seven characters of the stringrespectively notice that indexing begins at in the third examplewe are using stride of this results in every second character being returned in the final examplewe omit the end index and the slice returns every second character in the entire string you can use any expressionvariableor operator as an index as long as the value is an integerfor exampleanother common operation is traversing through string with loopfor example