Practice Makes Perfect: reverse


I can't understand how to join the individual string(I mean character , like "A", "B") that is created by for loop

Replace this line with your code. 
def reverse(text):
    adn = len(text)
    line = ""
    if adn >= 0:
        for i in text:
           line += text[adn-1]
            return line
            adn = adn-1 


+= will do that, perhaps your problem is something else. If you're only getting a single character then the problem is not that you didn't join them, but that you only included one.

Also, note that your code will not run, its syntax is not valid.


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