Replace this line with your code.


def reverse(word):

x = len(word)

while x > 0:
    return word[x-1]
    x -= 1

I'm not sure why it doesn't continue to loop round instead of just stopping with !. Help please


What does return do?
Can a function return multiple times? How does that work out?


I thought if it was within the while loop it would keep returning until x was 0


Thanks for your advice!

I've managed to do it now by appending a list and then joining that but still feel there must be a more elegant way of achieving the aim


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