C'est en forgeant qu'on devient forgeron


#1



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)


#2

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


#3

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


#4

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


#5

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.


#6

https://www.codecademy.com/fr/courses/python-intermediate-fr-FR-py0yl/0/4?curriculum_id=5370f030fed2a866a2000001


#7

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.