<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>
<Below this line, add a link to the EXACT exercise that you are stuck at.>
<In what way does your code behave incorrectly? Include ALL error messages.>
<What do you expect to happen instead?>```python
I was working on the reverse exercise in the Practice Makes Perfect tutorial for
Python. I got the function to work with the following code:
length = len(text)
rev = ‘’
while length > 0: rev = rev + text[length-1] length -= 1 return rev
That was my second attempt at a solution. My first attempt looked like this:
for i in range(length):
temp = text[i]
endIndex = length - (i+1)
text[i] = text[endIndex]
But it would not work and I kept getting the following error:
“Does your reverse function take exactly one argument (a string)?
Your code threw a “‘str’ object does not support item assignment” error.”
So I’m wondering if anyone can help me understand why my first attempt doesn’t work.
Can you not edit individual characters of a string like you can items in a list?
<do not remove the three backticks above>