Why does my code not work? please help


#1



https://www.codecademy.com/courses/python-intermediate-en-rCQKw/0/4?curriculum_id=4f89dab3d788890003000096#


it gives me :Oops, try again. Your function fails on digit_sum(434). It returns None when it should return 11.
and a none in the console


i should be getting a number sum instead, but i'm not sure why it does not work


def digit_sum(n):
    temp = 0
    while n>0:
        temp = temp + n % 10
        n = n // 10
    else:
        print (temp)


#2

you print the result instead of returning it (use the return keyword)


#3

oh. thanks! it works now


#4