C'est en forgeant qu'on devient forgeron


Oups, merci de réessayer. Votre fonction a échoué sur 434 comme entrée car votre fonction indique "'int' object is not callable" error.

def somme_chiffre(n):
    n = abs(n)
    total = 0
    while n >= 1:
        total += (n % 10)
        n = n//10
    return total
print somme_chiffre(434)


Essaye plutôt avec ceci pour voir
print (somme_chiffre(434))


Are you sure? Did you test this solution? The lesson is in Python 2, not 3.


Hey @mtf! Yeah I know but it costs nothing to try.:wink:


As I recall this exercise has an SCT bug. The correct code will not work. If you find a link to the page I'll see what work arounds we have.




As this is an old track that can no longer be maintained, it might be best to do the English language track where these bugs do not exist.

For this lesson, only, add the following after your completed code:

def somme_chiffre(n):
    return somme_chiffre

That will at least let you move on. There are a couple of other lessons with bugs, too, Can't remember right off, though.