Thank you. I got it fix, but not sure I understand the concept. Here is what I understand.
What I wrote means I just keep adding the last letter of the text for n times when n is equal to the length of the text instead of make it write the last letter only once and follow by the letter of the index before the last letter.
What I should do instead of the above is
rev_text += text[i]
when i is counting down by the for loop.
Another question though, I don’t understand very clear when I tried to write for-range loop counting down from the last letter to the first.
I know that the word “Hello” 's length is 5. When I attempt to write for-range loop of
range(start, stop, step)
The ‘start’ should be the last letter of “Hello” which is “len(‘Hello’) - 1”, right? Because the first index is counting from zero.
The ‘step’ is -1 because I want to count down from the last letter which is the highest index number down to zero by one.
The ‘stop’ is the tricky one. I don’t know which one I should put there, 0 or 1 or -1?
Should I put 1 because so 1 minus by 1 is equal to 0?
Or should I put 0 there because I want it to end at 0?
Or should I put -1 there because I know that each index will be minus by 1 in which index 0 minus by 1 is equal to -1?
Which strategies should I use when dealing with this type of problem?