This is a bit confusing and the hint doesn’t really help me much…

def digit_sum(n):

n = str(n)

total = 0

for i in n:

i = int(i)

total += i

return total

digit_sum(434)

It returns “4” instead of “11”

This is a bit confusing and the hint doesn’t really help me much…

def digit_sum(n):

n = str(n)

total = 0

for i in n:

i = int(i)

total += i

return total

digit_sum(434)

It returns “4” instead of “11”

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