Digit_sum "'int' object is not callable" error


I don't understand why I've got an error message as my code is working well in the console.

The error message says that the function fails with '434' and that the function says "'int' object is not callable" error.

Please help!

def digit_sum(n):
    n = str(n)
    sum = 0
    for i in range(len(n)):
        sum += int(n[i])
    return sum
print digit_sum(434)


works fine, try different browser/refresh page

you also might want to consider to name sum something else (like total), as you can see by the blue color, sum() is a built in function


It didn't work on Chrome and doesn't work either on Safari...
maybe it is because I'm using the french version then?


that one could be bugged, can you give me the exercise url? but shouldn't the function have a different name then? Please post your french code + exercise url


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

and the code is as below:

def somme_chiffre(n):
    n = str(n)
    total = 0
    for i in range(len(n)):
        total += int(n[i])
    return total
print somme_chiffre(434)


your code is fine, this exercise is bugged

get rid of all the code and place this in the editor:

def somme_chiffre(n):
     return somme_chiffre

this will break the exercise validition