the instructions for this problem are very misrepresented. first the example gives an illustration that says:

def digit_sum( 1234):

should return 10 because 1+2+3+4 = 10

so i understood this illustration as counting 1 + 2 + 3 + 4 not as one thousand two hundred thirty four.

so i tried using iteration or recursive method but the instead we are offered this long and cumbersome solution that does not really make much sense.

my code was as follow (using recursive method) and assuming i want the value of 10 to be return

def digit_sum(x):

if x == 1:

return 1

else:

return x + digit_sum(x-1)

digit_sum(4)

# Confusing instructions for practice makes perfect 3/15

**mtf**#2

The instructions are very clear and not confusing at all. The example perfectly illustrates what is expected.

**system**#3

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