The code is to reverse the string, but it fails. I can’t find out the problem. Can somebody help me?
I’m sorry for the format if there’s something wrong.
The code is to reverse the string, but it fails. I can’t find out the problem. Can somebody help me?
I’m sorry for the format if there’s something wrong.
Double check your syntax as it points out in the error message.
Sometimes the messages aren’t so clear as to where the issue is, but this one points directly where in your code there’s an issue.
Also, fwiw, if you read your code from the bottom up, it makes you see it/interpret it differently and you might have an easier time finding bugs.
Happy coding!
Thanks so much for your reply. You provide a new way for me: check my code from the bottom. I’ll try. Thanks again!
I don’t know why the staff removed my answer. I’ve solved this problem. The code went wrong because the colone in line 3, in the parentheses after range. It shouldn’t exist. The right syntax or form is:
for i in range(len(text)):