A lot of computations involve processing a string one character at a time. Often they start
at the beginning, select each character in turn, do something to it, and continue until the
end. This pattern of processing is called a traversal. One way to write a traversal is with a
while loop:


index = 0
while index < len(fruit):
letter = fruit[index]
print(letter)
index = index + 1

Respuesta :

Answer:

The last character in the string processed is "t".

Explanation:

The index start from 0 and the len(fruit) is 5.

When index is 0 which is less than 5; "f" is printed

When index is 1 which is less than 5; "r" is printed

When index is 2 which is less than 5; "u" is printed

When index is 3 which is less than 5; "i" is printed

When index is 4 which is less than 5; "t" is printed

When index is 5, the condition is false; so the loop content is not executed.

Therefore, the last character traversed in the string "fruit" is "t".

ACCESS MORE
EDU ACCESS