Digit_sum


#1



Hello guys, sorry for my bad English, but I need some help with my code...


def digit_sum(n):
total = 0
n = str(n)

for x in n:
    total = total + int(x)
    print total

print digit_sum(434)


4
7
11
None
None


When I put - Return Total - only returns the -4- instead total sum, something I miss?
P.D: I´m confusing with the sum() input, appears conflict with Int and Str D:



#2

Try removing the indentation before the print statement


#3

thank you , i´ll need more practice for dont make indentation errors :frowning:


#4

no worries, have fun :smiley:


#5

This topic is solved.