+ 1
How do I make a string spell backwards?
7 Respuestas
+ 3
it's very very simple!!
def spell(text):
    #first store the text into a list
    List=list(text)
    #then reverse the list
    reverse_list=List[::-1]
    #now print the text elements vertically
    for i in range(len(reverse_list)):
        print(reverse_list[i])
text=input()
spell(text)
+ 2
def spell(txt):
   #obtain the size of txt
    sizeTxt = len(txt)
   #latest create a while with condition that sizeTxt != 0
    while sizeTxt != 0:
    #print text vertically
        print(txt[sizeTxt-1])
    #change the sizeTxt to avoid an infiniti loop
        sizeTxt -= 1
txt = input()
spell(txt)
+ 2
def spell(txt):
    #your code goes here
    if len(txt)==0:
        return 
    else:
        print(txt[len(txt)-1:len(txt)])
        txt=txt[0:len(txt)-1]
        spell(txt)
txt = input()
spell(txt)
+ 1
I have the solution with recursive method:
def spell(text, size):
    if size == (-1):
        return ""
    else:
        return text[size] + "\n" + spell(text, size-1)
    
text = input()
size = len(text)-1
print(spell(text, size))
0
Letter Frequency
- 1
how use recursion?



