if you try to access an index beyond the end of stringthen python raises an indexerrorflavor[ traceback (most recent call last)file ""line in flavor[ indexerrorstring index out of range the largest index in string is always one less than the string' length since "fig piehas length of seventhe largest index allowed is strings also support negative indicesflavor[- 'ethe last character in string has index - which for "fig pieis the letter the second to last character has index - and so on the following figure shows the negative index for each character in the string "fig pie" - - - - - - - just like with positive indicespython raises an indexerror if you try to access negative index less than the index of the first character in the stringflavor[- traceback (most recent call last)file ""line in flavor[- indexerrorstring index out of range negative indices may not seem useful at firstbut sometimes they're better choice than positive index