- “l = len(text) - 1” doesn’t make it go backwards. It returns a number that we use to call the last index position of (text)
- For the word Python it would return 5 (the length of python (6) -1)
- The while loop uses index position 5 to call the last letter of Python, ‘n’, and add it to our blank word
- Then we count down by 1 (l -=1) (the part which makes it go backwards)
- We run it again as long as l >= 0 as stipulated in the while statement.
So. The while loop calls python adds n, l counts down to 4, the loop runs again calling index 4 and adds o, l counts down to 3, the loop runs again calling index 3 and adds h, and so on until l counts down to -1 at which points the while loop knows to stop. At that point we’ve added n, o, h, t, h, and p to our word in that order, giving us python backwards