What is a negative index in Python?

Hi, What is a negative index in Python

A negative index in python is indexing from the back, so say you have a string like this: “sample string”, now if you make a normal index like “sample string”[0], then you will get the first letter “s”, however, if you try this out “sample string”[-1], then this will start counting from the back, so the first letter from the back of the string will be given. So “g” would be the output. If you do “sample string”[-2] then “n” would be the output. You can think of it as, reversing the element and then indexing.