Question on range data type

i am unable to understand below problem how got the output.
example. print(range(10,21)[ : :-1])
output: range(20, 9, -1)
in the above output how i got the 9
plz explain

Remember that Python’s range has three arguments like this:

range(start, end, step)

The step defaults to 1.

The important thing is that the start value is included, but the end
value is excluded. So your first range:

range(10, 21)

includes 10 but excludes 21. So it gives the values:

10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20.

Now we take a slice with the step set to -1, which reverses the range:

range(10, 21)[::-1]

20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10.

In the new, reversed, range, we need the start value to be 20, and the
step to be -1. What is the end value? Remember, the end value is
excluded. So the range is:

range(20, 9, -1)

That will step backwards 20, 19, 18, … 11, 10 and then stop.

i am unable to understand below problem how got the output.
example. print(range(10,21)[ : :-1])
output: range(20, 9, -1)
in the above output how i got the 9
plz explain

It has to do with how endpoints are handled by range(), the start
parameter is inclusive but the stop parameter is exclusive. This is
easier to observe if you create a list structure from your range:

>>> list(range(10,21))
[10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
>>> list(range(10,21)[::-1])
[20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10]

You’ll see they still contain the same elements, the second one is
simply in reverse order, so the inversion on the slice worked as
intended. See the Python library documentation for more details:

https://docs.python.org/3.8/library/stdtypes.html#typesseq-range

Thank u so much for ur great explaination now i understand this concept