Digit_Sum help Requested



Error message: "Oops, try again. Your function fails on digit_sum(434). It returns None when it should return 11." Not sure how to amend the code correctly.

Replace this line with your code. 
def digit_sum(n):
    sum = 0
    while n > 0:
        sum += n % 10
        n = n // 10
    print sum


Try changing:
print sum
return sum


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