stride in python code example
Example: python stride
# The stride is the third (and optional) number in a slice.
# The default value is 1.
myString = "string"
# prints every second character, beginning with the 0th index
print(myString[::2]) # outputs "srn"
# prints every second character, beginning with the last index and going backwards
print(myString[::-2]) # outputs "git"
myList = [0, 1, 2, 3, 4, 5, 6, 7]
# prints every third character, beginning with the 0th index
print(myList[::3]) # outputs [0, 3, 6]
myTuple = ("a", "b", "c", "d", "e")
# prints every character
print(myTuple[::]) # outputs ("a", "b", "c", "d", "e")