Reverse

Hello guys!

I have a question regarding my code for the reverse exercise.

My code seems to work but it tells me that it does not.

Here it is:

def reverse(text):
cont = len(text)
s = ‘’
while cont > 0:
cont = cont - 1
s = s + text[cont]
print s

Thank you

Your function should return a value, not print it.

Thanks!

I have been trying some stuff before to understand the code. That’s why I left the print command.

:sweat_smile:

1 Like

For testing, print is your friend, but once you are ready to submit, be sure they are removed. You can print the function call, itself. The return value is what will print.

print (foo(bar))