4. Digit sum - It's correct but it wont let me pass!


#1

this is my code

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

digit_sum(434)

and this is my error

Oops, try again. Your function fails on digit_sum(434). It returns None when it should return 11.

and this is what is in my out put screen

11
None

what do I do?
i've refreshed the browser and it still wont pass.


#2

If your function does not return something it will return None, so change it so you return the total instead of printing it out.


#3

thank you very much! that worked perfectly