Problems with (15.4) - digit_sum exercise


#1



https://www.codecademy.com/courses/python-intermediate-en-rCQKw/0/4?curriculum_id=4f89dab3d788890003000096


I don't get it, I tried to change the code in various ways but I still get: 'int' object is not callable or 'float' object is not callable errors
Although in PyCharm the code runs just fine. Does it have something to do with the Python version difference - cause Codeacademy is on Python 2.7, right - ?
Does anyone know where's the problem ?
Thanks ^^


def digit_sum(x):
    number = int(x)
    result = 0
    while number != 0:
        result += number % 10
        number /= 10
    return result


#2

HI try to refresh the page bcause I ran your code and it works..

e


#3

Oh, that's interesting !
All the time I was working in the french version of Codeacademy, but when I switched to English the code worked fine. So the problem is actually in the french version of this exercise.
Thanks for your advice and help ^^


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.