Digit_sum function


Can someone please explain to me what is wrong with my code.

def digit_sum(n):
num_string = str(n)
num_list = []
total = 0
for digit in num_string:
for i in num_list:
total += int(i)
print total

It seems to be working when I try it, I can't go forward
Please help


Wait, nevermind. Got it


So what did you do I did basically the same thing and it out puts the correct sum but I fear I am having the same problem you had at first?


You have to use the return statement in a function. if you don't python will return "None"
change print total to return total