Spelling Backwards in python
Hi i was doing a code project of the intermediate python course and i have already solved it but my question is: Is there a way to print the text backwards without changing it? like printing it as the function runs =================================================================== NEXT IS THE CODE PROJECT STATEMENT: Spelling Backwards 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. =================================================================== MY SOLUTION: def spell(txt): #your code goes here def reverse(txt): if len(txt) == 0: return txt else: return reverse(txt[1:]) + txt[0] txt = reverse(txt) for i in txt: print(i) return txt = input() spell(txt) =================================================================== I would like to know how you would have solved it or other ways to solve that problem