+3 votes
in Class 12 by kratos

What is the use of negative indices in slicing?

1 Answer

+2 votes
by kratos
 
Best answer

Python counts from the end (right) if negative indices are given.

(eg) * = “Hello”

print *[:-3] >> He

print *[-3:] >> llo

...