def digit_sum(n): a = abs(n) b = str(a) c =  for char in b: c.append(int(char)) return sum ( c )
Doesn’t work, or doesn’t pass?
forgive me if that’s a stupid question, but what’s the difference?
doesn’t work means the code does not produce the correct digit sum, doesn’t pass means its not passing the exercise despite producing correct digit sum
well, actually, it returns only the absolute of the first digit in the number.
what does absolute have to do with it? I ran your code, and it worked fine
I have no idea, why, but thank you for editing my post - it turned out my indentation was wrong. Thank you for your help and sorry for my unperspicacity.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.