4. digit_sum I'm right but it says I'm wrong


It says "Oops, try again. Your function fails on digit_sum(434). It returns None when it should return 11."
but when I tested it out, it returned 11.

def digit_sum(n):
    x = 0
    while n > 0:
        y = n % 10
        x += y
        n = n // 10
    print x


Ah... I see what happened.
I did print instead of return


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