Skip to content

Question 7

Evaluate:

'axolotl'[-4]
Solution

Negative indexes means looking backwards from the last character onwards. Here, index -1 gives l, -2 gives t, etc. At index -4, it is l.

Note

It is still possible to go out of range with negative indexes. In this case, accessing index -8 and lower will render an IndexError.

Answer
'l'