4 - digit_sum


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

print digit_sum(1234)


What is your question? We need to know so we can help you the best we can.


I'm sorry...anything problem...the code is correct ! Thank you.


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