7.reverse


#1




Error message is bellow.
Oops, try again. Your function fails on reverse("Python!"). It returns "P" when it should return "!nohtyP".


I hope working not only P


def reverse(text):
    new_word=""
    i=1
    for i in range(len(text)-1):
        new_word = new_word + text[-i]
        i=i+1
        return new_word
        
reverse("Python!")


#2

The for statement is managing this variable (i). We cannot manipulate it.

This is returning in the first iteration cycle. Remove some of the indentation.


#4

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