could any one help me to solve this program?

Thank you


Firstly, your function definition is incorrect. You don't define a function by passing a string literal into its argument definition, do you? Think of how you might write that definition correctly.

Secondly, your for loop does not reference any local variables. You have not passed in a "reverse" variable, so there is nothing to loop.

Thirdly, the exercise distinctly says not to use "reversed", so printing the variable reversed -- specially when it's not a local variable -- won't work.

How might you start at the end of the string (its last index) and loop to the first index? From that, can you build a string? If so, that string would be the reverse of the string passed in. You'll need to rethink how you're doing t his exercise, first, though.


oh man you have too many mistakes in your code.



i'm stuck here. i know this isn't the most elegant solution but something tells me that it could work with slight changes: i get an error saying: "-it threw a "can't assign to function call (python, line 6)" error."

def reverse(text):
text = str(text)
new = []
for i in range(len(text), 0):
print (new)
len(text) -= 1

Any hint?

Thanks in advance!


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.