15/4 somme_chiffre


#1



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


def somme_chiffre(n):
totalx = 0
strn = str(n)
for x in strn:
totalx += int(x)
return totalx

print somme_chiffre(1234) # for test
`


#2

Is there a question to go with this post, or is this just a solution?

Y at-il une question d'aller avec ce poste, ou est-ce juste une solution?


#3

yes this code is just but it said me error """ Oups, merci de réessayer.
Votre fonction a échoué sur 434 comme entrée car votre fonction indique "'int' object is not callable" error.


#4

I went through this module yesterday, and found a few lessons were impossible to pass without a workaround. Fortunately we have some gurus here who have come up with solutions, per se. Maybe not actual solutions to the exercise, which we should still solve, but solutions to the SCT issue.

After your code above, add this and submit...

def somme_chiffre(n):
    return somme_chiffre

#5

thanks but I have solve this CodeCademy bug by adding this line at the end:

Exception = "somebody should get around to fixing this..."


#6