strings [ [ [ [ [ [ figure string indexes getting the length of string using len len is built-in function that returns the number of characters in stringfruit 'bananalen(fruit to get the last letter of stringyou might be tempted to try something like thislength len(fruitlast fruit[lengthindexerrorstring index out of range the reason for the indexerror is that there is no letter in "bananawith the index since we started counting at zerothe six letters are numbered to to get the last characteryou have to subtract from lengthlast fruit[length- print(lasta alternativelyyou can use negative indiceswhich count backward from the end of the string the expression fruit[- yields the last letterfruit[- yields the second to lastand so on traversal through string with loop lot of computations involve processing string one character at time often they start at the beginningselect each character in turndo something to itand continue until the end this pattern of processing is called traversal one way to write traversal is with while loopindex while index len(fruit)letter fruit[indexprint(letterindex index