Practice makes perfect Exercise digit_sum

Hi! Please, how can I prove this solution? I create a variable x = 1234 but don’t work!! Thanks!!

def digit_sum(x):
    total = 0
    while x > 0:
        total += x % 10
        x = x // 10
        print x
    return total

That is why there is a simple rule… Don’t use code you didnt’ create if you don’t understand how it works.

Thanks!..but don’t help, professor.

Not sure what the problem is on your end. The code looks and works fine. Have you tried calling the function?