Digit_sum


#1



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

This code just returns none

Why is nothing happening pls help


def digit_sum(n):
    z=str(n)
    key=0
    while key is range(len(z)):
        total=''
        append.total(z[key])
        total1=sum(total)
        key+=1
        return total1

print digit_sum(1234)


#2

Never gonna happen. key is 0.


#3

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