0

# Spelling Backwards

I need help on the spelling backwards challenge.

4/1/2022 3:55:40 PM

Ilyas Guissous

+4

def spell(txt): #your code goes here if txt=="": return else: print(txt[-1]) return spell(txt[:-1]) txt = input() spell(txt)

+1

Language?? And what to do? (elaborate it)

+1

Ilyas Guissous , please also put your code in playground, save it and post the link to this file here. thanks!

+1

it seems to be the *intermediate python* tutorial exercise 19. the task description is: Given a string as input, use recursion to output each letter of the strings in reverse order, on a new line. Sample Input HELLO Sample Output O L L E H Complete the recursive spell() function to produce the expected result

+1

Beh , your codes are not both absolutely correct, since the first one outputs the string in one line. but following the task description this task should be done with a recursive function.

0

Use [::-1] Example: Str = str(input()) print(Str[::-1]) ******************************* There is another way: Str = str(input()) List = list(Str) List_reverse = List[::-1] for i in List_reverse: print(i)