Reverse, "'str' object is not callable


#1

Hello I'm stuck with the reverse exercise, my code works perfectly. But the console return "Oups, merci de réessayer. Votre fonction a échoué sur coolstory comme entrée car votre fonction indique une erreur "'str' object is not callable"." and I don't understand it, anybody can help me please ?


def inverser(a):
    m=""
    c=len(a)-1
    for x in range(len(a)):
        m+=a[c]
        c-=1
    return m
print inverser("abcd")


#4

https://www.codecademy.com/fr/courses/python-intermediate-fr-FR-py0yl/1/1

This exercise has a known bug. Digging around in the archive one will find this (sorry, I didn't bookmark it)...

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

Insert it above your code and assuming your program works properly, this will let you pass the lesson.


#5

Thanks you it works =)