"int object is not callable" in my code


#1

Hi, sorry for the confusion i'm following the course in french.

My code returns the good number, but i can't advance because of this error message.

Could someone help me please, i'm a beginner.


#2

could you please type your code as text ?


#3

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

print somme_chiffre(1234)


#4

well, it's working smoothly

def somme_chiffre(n):
    n = str(n)
    total = 0
    for x in n:
        x = int(x)
        total += x
    return total
print somme_chiffre(1234)

where is the problem ? :confused:


#5

anyways this is my code :

def digit_sum(n):
    num=str(n)
    total=0
    for i in num:
        total += int(i)
    return total
print digit_sum(12345)

#6


#7

Well i'm wondering if there is an error in the french version...


#8

well, I'm not in that level in these things but probably you're right.


#9

Thanks for answering anyway ! :slight_smile:


#10

Pas grave avec plaisir :slight_smile:


#11

Hi ! I'm French and I have the same issue... There's a lot of them in the French version, plus some translation issues... Still some work to do on this version


#12

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