Reverse - 'str' object is not callable


def inverser(texte):
    texte2 = ""
    nombre = len(texte) - 1
    while nombre >= 0:
        texte2 += texte[nombre]
        nombre -= 1
    return texte2

It works but this error always show up :
"'str' object is not callable".

Can you help me please ? :slight_smile:


Hi @fokushy,

There is a bug in this exercise. Add this to the beginning of your code, as a workaround ...

class str:
    def __add__(self, other):
        return True


Thank you for the speed, but it's been several months that I left this exercise aside because I could not solve this error, I returned sometimes to try again but always the same, otherwise, refresh the page does not solve the problem.
The link of the exercise:


Thanks for the link to the exercise.

The French version of this exercise has a bug in the submission correctness test (SCT). In that version of the exercise, adding this to the beginning of the code will enable your code to pass ...

class str:
    def __add__(self, other):
        return True


Many thanks ! It worked :smiley: