How does the stride work in list slicing?
When we want a slice of a list, we can specify the
stride is 1 by default and will go through each number in the range. If you change the number, then that’s by how many it’ll change each time. Take a look at the example below for a better understanding:
my_name = “BobbyTarantino” print my_name[::1] #BobbyTarantino print my_name[::-1 ]#onitnaraTybboB print my_name[::2] #Bbyaatn print my_name[::-2] #oinrTbo